title: Pushing new Fragment with supportFragmentManager
body: <p>I am inside <code>onBindViewHolder</code> and i want to <strong>show a new Fragment</strong> in <code>holder.view.setOnClickListener { }</code></p>
  
  <p>I'm passing the current fragment in my Adapter: </p>
  
  <pre class="lang-kotlin prettyprint-override"><code>class HomeAdapter(val fragment: Fragment?) : RecyclerView.Adapter&lt;HomeAdapter.ViewHolder&gt;() {
  </code></pre>
  
  <p>if i try to use <code>supportFragmentManager</code> <strong>nothing</strong> happens if i tap a row:</p>
  
  <pre class="lang-kotlin prettyprint-override"><code>fragment
    .requireActivity()
    .supportFragmentManager
    .beginTransaction()
    .add(R.id.main_fragment, GalleryFragment())
    .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
    .addToBackStack("HomeFragment")
    .commit()
  </code></pre>
  
  <p>However if i use the <strong>deprecated</strong> one it works:</p>
  
  <pre class="lang-kotlin prettyprint-override"><code>fragment
    .requireFragmentManager()
    .beginTransaction()
    .replace(R.id.main_fragment, GalleryFragment())
    .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
    .addToBackStack("HomeFragment")
    .commit()
  </code></pre>
  
  <p>I don't want to use the deprecated one. Is there a way to fix this?</p>
  
  <p>Edit:</p>
  
  <p>This is my class where i call <code>onClickListener</code>:</p>
  
  <pre class="lang-kotlin prettyprint-override"><code>class DhikrHomeAdapter(val fragment: Fragment?, val data: Array&lt;PreviewDhikr&gt;) : RecyclerView.Adapter&lt;DhikrHomeAdapter.ViewHolder&gt;() {
  
      override fun getItemCount(): Int {
          return data.size
      }
  
      override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
          val inflater = LayoutInflater.from(fragment?.requireContext())
          val cell = inflater.inflate(R.layout.dhikr_row, parent, false)
  
          return ViewHolder(cell)
      }
  
      override fun onBindViewHolder(holder: ViewHolder, position: Int) {
          val cell = holder.view
  
          val currentDhikr = data[position]
          cell.dhikrType.text = currentDhikr.dhikrType.rawValue
          val img = fragment?.requireContext()?.resources!!.getIdentifier(currentDhikr.previewImage, "drawable", fragment.requireContext().packageName)
          cell.backgroundImage.setImageResource(img)
  
          cell.setOnClickListener {
              fragment
                  .requireFragmentManager()
                  .beginTransaction()
                  .replace(R.id.main_fragment, DhikrFragment(currentDhikr))
                  .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
                  .addToBackStack("HomeFragment")
                  .commit()
          }
      }
  
      class ViewHolder(val view: View): RecyclerView.ViewHolder(view)
  }
  </code></pre>