Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

ListView on Android, occasionally displays the wrong image

$
0
0

This issue only happens on Android - not IOS.
When I have a lot of scrolling up and down, upon occasion, the image displayed is the wrong image.
I can say it is the wrong image because when I tap on the image, I print out the imagesource file name, (Console.WriteLine(((FileImageSource) this.userThumbnailImage.Source).File);) the printed value is indeed of the image I expect to see.
In other words - it seems like the rendering is ignoring the new image value and using whatever was in a buffer or a cache or what not.
If I scroll up and down, after a while that cell "snaps" back and displays the correct image.
I do not use databinding here - I have a reference to the individual cells and I update them directly.
All the updates take place while on the UI thread in response to a tap (the updates take place when I re-order parts of the list, I do not re-order the ArrayList rather I copy values from one entry to another).

It is worth noting that there is a another image in the cell and 5 labels - all show the correct values.

This issue is not predictable - it comes and goes randomly and is only on Android.
It does not happen on the emulator (I see it happening on a Galaxy S3 phone) and only when I have a few hundred cells in the list.

Question: is there a way in Android's Custom Renderer (ViewCell renderer or Image Renderer) to force it to reload images or completely invalidate whatever it was displaying and make sure that it displays the correct image?


Viewing all articles
Browse latest Browse all 58056

Trending Articles