Tricky question: how do you handle item clicks in ...
# android-architecture
u
Tricky question: how do you handle item clicks in RecyclerView? do you recreate listeners every onBind? do you create listeners in constructor and pass in cached field Item? do you do the same but pass in adapterPosition, and pull out the object from the list at adapter level?
why I'm asking this is, because this will have stale data if you use DiffUtil with payloads
and most likely you are recreating the listeners every on data bind, no?
a
I checked docs for it and it is depricated (DiffUtil)
So why creating your code around depricated api, but for the second part, I think it will create a new listener to each layout it creates inside recycler
u
DiffUtil is not depracated
a
message has been deleted
Unless there is another DiffUtil it has stamps Deprecated all over the docs 🤷
u
because it moved packages since androidx
as you se there is android.support.v7 in there
a
Makes sense
They usually have a link to the new one though in the docs
a
on desktop version they have something, looks like it’s not shown on mobile