title: android.view.ContextThemeWrapper cannot be casted to android.app.Activity
body: <p>I have a scenario in which I'm supposed to inject a Class into my recyclerview. In order to inject my dagger class I need to get hold of context .so I wrote the following code in my recyclerview class </p>
  
  <pre><code> Components.&lt;DepComponent&gt;getFrom(parent.getContext()).inject(this);
  </code></pre>
  
  <p>Inside the<code>DepComponent</code> I have an inject method in which this particular recycler view is also added </p>
  
  <p>When I run the code I am getting this error</p>
  
  <p><code>android.view.ContextThemeWrapper cannot be cast to target.dagger.HasComponent</code></p>
  
  <p>I have tried to cast <code>(Activity)parent.getContext()</code> but the following error is being thrown</p>
  
  <p><code>android.view.ContextThemeWrapper cannot be cast to Activity</code></p>
  
  <p>Any suggestions on how to resolve this? Looks like parent.getContext() is returning <code>ContextThemeWrapper</code> which is not being casted to an activity</p>