title: getActivity() from non activity class Kotlin
body: <p>I would like to go from <code>Fragment</code> to an <code>Activity</code> by clicking on an item of <code>Fragment</code>'s <code>RecyclerView</code>.  <code>RecyclerView</code> adapter is made in separate class, so in that class in the part of <code>setOnClickListener{}</code> I have to write the <code>Intent</code> part. </p>
  
  <pre><code>holder.itemView.setOnClickListener{
  
              val intent = Intent(MainActivity.getActivity(),DetailsActivtiy::class.java)
  
              intent.putExtra("ImageUrl", uri)
  
              MainActivity.getActivity().startActivity(intent)
  }
  </code></pre>
  
  <p>The problem as you might already guessed is <code>MainActivty.getActivity()</code> .
  I tried the approach from <code>Fragment</code> via <code>onButtonClick</code> instead of <code>MainActivty.getActivity()</code> I wrote only <code>activity</code> and it worked perfectly but it does not work in <code>RecyclerView</code> adapter because it is non activity class. How to solve my problem?
  Best, Armen.</p>