Android Volley - Cancel NetworkImageView request in Base Adapter
As the title says, I'm using a BaseAdapter to display items in a ListView.
Obviously a ListView will reuse views, including TextViews and
NetworkImageViews.
Assuming 3 items can be displayed at once, the NetworkImageView will be
reused for items at index: 1, 4, 7, ....
Depending on what's being displayed, the NetworkImageView will either:
request the image from the Network and display it,
display a cached Bitmap,
or display a local drawable resource.
Items 2 and 3 work fine, however in Scenario 1, let's say we're displaying
item at index 4 from the network, and the user scrolls to item 7 before 4
is loaded and it's a local resource, we display the local resource.
However our network image request may just be finishing now, so we end up
displaying an incorrect image.
How can I enforce the proper (expected)behavior?
No comments:
Post a Comment