Up to this point, I wrote listeners in RecyclerView right in onBindViewHolder . But I saw somewhere that you can’t do that. What about then? Can the perfect code?
|
1 answer
I advise you to use this solution: ItemClickSupport . This decision is used by many. I made for myself in one class.
- Are you from Samara?) Thanks for the lib) - Flippy
- Yes, I am from Samara - pavel163
- Cool me too) but can I talk to you? On the topic of career. - Flippy
- I think that for such a simple action you can also throw your callback, just a couple of lines than to connect it. - pavlofff
- In one class, and the same callbacks are used. Just a little more convenient. but this is my opinion. - pavel163
|
getAdapterPosition()or create thebindmethod and pass the listener and the position to it. What is better, I do not understand. - Flippy