I don't know if this is a trivial issue but, I couldn't find information about it anywhere else. How does one execute Fragment
transactions to replace Fragments
when a RecyclerView
item is clicked. Normally you would extend the Fragment
class but I can't because the RecyclerAdapter
class already extends RecyclerView.Adapter<MyRecyclerAdapter.ViewHolder>
.
You can define a ItemClickListener
interface and use it to notify the fragment when an item has been clicked. You can do the fragment transaction in the fragment.
You can find a full project with a code sample here. Courtesy of the Styling Android blog.