Prior to the introduction of RecyclerView
(and its mandatory ViewHolder
pattern), I usually delegate any click events to its corresponding Activity
/Fragment
using setOnItemClickListener()
. (Because I mainly see Activity
/Fragment
as a "controller" object when developing for Android, thus any modification to the view should be done in it.)
Now, as RecyclerView
doesn't really treat its children the same way and that setOnItemClickListener()
(or similar) methods are no longer implemented for it - where should I handle click events that may take place? I don't know.. but handling them in an Adapter
seems awkward to me.
How are we supposed to do it?
Thanks in advance!