I'm guessing that your Activity
uses an AsyncTask
to download images, which are then decoded in the Adapter
's getView()
method. If the user of your app scrolls up and down too quickly, then your images can get blurred / swapped and your app can become unresponsive as the AsyncTask
threads go crazy trying to cope with the downloading & caching and your Adapter
struggles with the decoding.
Have you heard of the new Volley
networking library for Android ? It's developed at Google (its a part of the AOSP). I suggest you give it a try as it is asynchronous by default (it abstracts away the downloading, caching & decoding while providing a very clean interface to the developer). I'm using it for HTTP requests & image downloading, and its very fast and stable. You can even control thread priority & cancellation. There is no blurring or stuttering of listviews / gridviews, and it can handle very large images with ease. Picasso is another great option for the image downloading part. Picasso is slightly slower than Volley for downloading images, but its just as stable and TRIVIAL to integrate (one line of code in your adapter).
Volley and Picasso work beautifully even if you don't add the notifyDatasetChanged()
method to your Adapter
's getView()
(though of course it is good practice to do so). As the getView()
method is called on demand, both only download the image when the user scrolls down.
See an example of image downloading with Volley here.