Hello,
Welcome to our Microsoft Q&A platform!
why is it not being updated by OnBindViewHolder before being shown again?
After updating the data of one item in code behind, once the item is visible in the screen, it will call function onBindViewHolder
to update the UI.
On the other hand, if it's not in the visible area of the screen, the ViewHolder will be occupied by some other item which is in the visible area of the screen.
This is due to the ViewHolder
reuse mechanism.
You can override method OnViewRecycled
to verify this.
public override void OnViewRecycled(Java.Lang.Object holder)
{
base.OnViewRecycled(holder);
YourViewHolder holder1 = holder as YourViewHolder ;
System.Diagnostics.Debug.WriteLine("OnViewRecycled: " + holder1.CaptionTv.Text+"<---> position = "+ holder1.AdapterPosition);
}
Best Regards,
Jessie Zhang
---
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.