Skip to content Skip to sidebar Skip to footer

Android Async Loading Images In Listview - Images Are Blinking

I have been struggling with asynchronously loading images in ListView, because while they're loading, some of them are blinking (they're are replaced by another loaded image) and s

Solution 1:

In addition to what Forin has said, there are many libraries that really help out on things like this. My personal favorite at the moment is AQuery:

https://code.google.com/p/android-query/

Let's say you have an ImageView and you want to download an image and set the imageView to hold that image. Sounds sort of difficult, right? With AQuery this is done in one line:

aq.id(R.id.name_of_image_view).image("http://url-of-image.com/image.png");

aq in this case is an AQuery object declared like so:

AQueryaq=newAQuery();

Solution 2:

Firstly, you should reconsider using this library:

https://github.com/nostra13/Android-Universal-Image-Loader

It will help you downloading images and displaying them in ListView.

Your problem is connected with recycling views in ListView. So your ImageView in getView() is reused, that's why positions in your list are changing. If you are using holder and have something like holder.image.setImageDrawable(...) inside if/else statement, you should move it outside condition, just above return.

Post a Comment for "Android Async Loading Images In Listview - Images Are Blinking"