title: recyclerview in fragment context not working in kotlin
body: <p>Im creating a really basic <code>recyclerview</code> in <code>fragment_home.xml</code> which is linked to a <code>&lt;FrameLayout /&gt;</code> inserted in <code>activity_main.xml</code></p>
  <p>It works well...until I create the <code>HomeFragment</code> class in <code>HomeFragment.kt</code>, which inflates <code>fragment_home.xml</code></p>
  <p>Then I want to add up the arrayList (<code>arrayHomeMenu</code>) in the function <code>onActivityCreated()</code></p>
  <p>my problem is with this line</p>
  <pre><code>  val homeMenuAdapter = HomeMenuAdapter(arrayHomeMenu, this) //context &quot;this&quot; appears with red underline
  </code></pre>
  <p>It retrieves error, so I cant continue...</p>
  <p><strong>HomeFragment.kt</strong></p>
  <pre><code>   class HomeFragment : Fragment() {
     override fun onCreateView(
      inflater: LayoutInflater, container: ViewGroup?,
      savedInstanceState: Bundle?
      ): View?{
      return inflater.inflate(R.layout.fragment_home, container, false)
  
   }
  
  
  override fun onActivityCreated(savedInstanceState: Bundle?){
      super.onActivityCreated(savedInstanceState)
  
  
      //create list of words
      val arrayHomeMenu = ArrayList&lt;HomeMenuModel&gt;()
  
      arrayHomeMenu.add(HomeMenuModel(&quot;Verbs&quot;,&quot;List of 461  words&quot;, R.drawable.ic_logo))
      arrayHomeMenu.add(HomeMenuModel(&quot;Nouns&quot;,&quot;List of 52 words&quot;, R.drawable.ic_logo))
      arrayHomeMenu.add(HomeMenuModel(&quot;Adjectives&quot;,&quot;List of 65 words&quot;, R.drawable.ic_logo))
      arrayHomeMenu.add(HomeMenuModel(&quot;Adverbs&quot;,&quot;List of 345 words&quot;, R.drawable.ic_logo))
  
      val homeMenuAdapter = HomeMenuAdapter(arrayHomeMenu, this) //context &quot;this&quot; appears with red underline
  
  
      homeMenu_recyclerView.layoutManager = LinearLayoutManager(context)
      homeMenu_recyclerView.adapter = homeMenuAdapter
  
  }
  </code></pre>
  <p>This is a <code>context</code> problem....</p>
  <p>I tried to replace <code>this</code> by <code>activity</code>, <code>context</code>, <code>Context</code>, <code>applicationContext</code> with not success at all...</p>
  <p><strong>HomeMenuAdapter.kt</strong></p>
  <pre><code>class HomeMenuAdapter(val arrayList: ArrayList&lt;HomeMenuModel&gt;, val context: Context) :
  RecyclerView.Adapter&lt;HomeMenuAdapter.ViewHolder&gt;() {
  
      ....//correct content
     }
  </code></pre>
  <p>It works correctly when I create the recyclerview direct in <code>activity_main.xml</code> and work directly with <code>MainActivity.kt</code></p>
  <p>Once I move the recyclerview to a fragment...it throws the error described above.</p>
  <p><strong>HomeMenuModel.kt</strong></p>
  <pre><code>  class HomeMenuModel(val hm_title:String,val hm_description: String, val hm_image:Int)
  </code></pre>
  <p>I was checking this <a href="https://stackoverflow.com/questions/50427209/kotlin-android-fragment-recyclerview-and-context-issue">answer</a>, but no success...</p>
  <p><strong>what am doing wrong??</strong> thank you</p>