https://kotlinlang.org logo
#android-architecture
Title
# android-architecture
u

ursus

11/26/2019, 9:17 PM
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

Anastasia Finogenova

11/27/2019, 1:54 AM
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

ursus

11/27/2019, 2:06 AM
DiffUtil is not depracated
a

Anastasia Finogenova

11/27/2019, 3:47 AM
message has been deleted
Unless there is another DiffUtil it has stamps Deprecated all over the docs 🤷
u

ursus

11/27/2019, 4:23 AM
because it moved packages since androidx
as you se there is android.support.v7 in there
a

Anastasia Finogenova

11/27/2019, 2:33 PM
Makes sense
They usually have a link to the new one though in the docs
a

arekolek

11/27/2019, 2:44 PM
on desktop version they have something, looks like it’s not shown on mobile
2 Views