https://kotlinlang.org logo
Title
m

morozov

07/06/2017, 2:59 PM
but how correctly i can make transition on some fragment from my viewHolder, when i make click on someView?
someView.setOnClickListener {
                val manager = (context as Activity).fragmentManager
                manager.beginTransaction().replace(R.layout.fragment_transaction_edit, TransactionEditFragment()).commit()
            }
for me that way doesn t work
l

louiscad

07/06/2017, 3:36 PM
@morozov: Create an interface called
Host
in your RecyclerView.Adapter class that can be implemented by your Activity where item clicks and other user interaction on list items will be forwarded. Then add a constructor property of this interface to your Adapter, and to your ViewHolder(s) class(es), so you can call the methods from your ViewHolder which get to the Host