So to save the item id --> holder.getItemId() ?...
# android
v
So to save the item id --> holder.getItemId() ??
p
hi
reply here. not the chat box
v
Hi
I have stored the item id globally
p
1. register your click listener within onBindViewHolder.
do you have it like that right?
v
Yes
p
ok perfect.
now, you can have a boolean value instead inside your viewholder.
or something like said, wasClicked :Boolean
v
Okay
p
but, also remember you have to set it to false when that item was not clicked
hold on let me see if can help you with code base better
v
Sure
look this is what i mentioned before
having it global
checkedPosition != getAdapterPosition())
the trick is to use getAdapterPosition, don’t use getPosition
or getCurrentPostion don’t remember the proper name
v
Yes let me see this
Thanks for the quick help
p
anytime
i have been developing android apps for more than 7 years and i still forget things
🙂