nostra13/Android-Universal-Image-Loader — pull request #85 by Vitaly-Olshevsky (2012-10-26 15:19:19+00:00)
Title: There is a small improvement that should prevent showing a wrong bitmap in the recycled view

Hi,

Sometimes when I scroll a ListView, wrong images appear in recycled views. These images appear just for a moment until actual images are loaded. It happens quite rarely, but it is still very irritating.

Here is the simple scheme of what is actually happening in the code:

1. Some image is completely loaded in a background thread, it is checked for actuality and a new DisplayBitmapTask is posted to the UI.

2. Some views are recycled. Among them is a view that is still linked with the image from item 1. At this point the image becomes not actual.

3. The DisplayBitmapTask from item 1 is finally executed and unfortunately it shows the wrong image.

So I added a simple actuality check into the DisplayBitmapTask. Therefore there is no single chance for an inactual image to be shown. Please review this fix and apply it if you want.