title: Context this problem in fragments Kotlin Android Studio
body: <p>Hello everyone I have problem with code that I find in internet.
  Many times when I want to apply code from internet to my app I have problem with one thing &quot;this&quot;</p>
  <p>there is a example</p>
  <p>listview.adapter = Adapter(this, R.layout.tescik,list)</p>
  <p>every time that I paste code to fragment I have red lined &quot;this&quot; and i really dont know how to fix it, I cant find the solution.
  Can anyone help me how to fix this (heh) problem?</p>
  <p>there is is my code where i try to implement it.</p>
  <pre><code>package com.example.darwinaapp.podstrony
  
  import android.os.Bundle
  import androidx.fragment.app.Fragment
  import android.view.LayoutInflater
  import android.view.View
  import android.view.ViewGroup
  import android.widget.ListView
  import com.example.darwinaapp.Adapter
  import com.example.darwinaapp.Model
  import com.example.darwinaapp.R
  import kotlinx.android.synthetic.main.fragment_promocje.*
  
  private const val ARG_PARAM1 = &quot;param1&quot;
  private const val ARG_PARAM2 = &quot;param2&quot;
  
  
  class Promocje : Fragment() {
      private var param1: String? = null
      private var param2: String? = null
  
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          arguments?.let {
              param1 = it.getString(ARG_PARAM1)
              param2 = it.getString(ARG_PARAM2)
  
  
          }
      }
  
      override fun onCreateView(
          inflater: LayoutInflater, container: ViewGroup?,
          savedInstanceState: Bundle?
      ): View? {
  
          var listview = lista
          var list = mutableListOf&lt;Model&gt;()
  
          list.add(Model(&quot;Maravedi&quot;, &quot;Bardzo dobre winko&quot;, R.drawable.heroesmerlot))
          list.add(Model(&quot;Maravedi&quot;, &quot;Bardzo dobre winko&quot;, R.drawable.heroesmerlot))
          list.add(Model(&quot;Maravedi&quot;, &quot;Bardzo dobre winko&quot;, R.drawable.heroesmerlot))
  
  //There is my problem
          listview.adapter = Adapter(this, R.layout.tescik,list)
  //There is my problem
  
          return inflater.inflate(R.layout.fragment_promocje, container, false)
      }
  
      companion object {
  
          fun newInstance(param1: String, param2: String) =
              Promocje().apply {
                  arguments = Bundle().apply {
                      putString(ARG_PARAM1, param1)
                      putString(ARG_PARAM2, param2)
                  }
              }
      }
  }
  </code></pre>