I am populating a ListView with images downloaded from URLs.
When I scroll the screen the images in the ListView
take a moment or two to reappear.
How can I fix that?
I am populating a ListView with images downloaded from URLs.
When I scroll the screen the images in the ListView
take a moment or two to reappear.
How can I fix that?
I'm guessing you mean the images take a moment to load when you scroll back to them.
The reason this happens is because the Android system has reclaimed the resources that were used to hold these images in the current activity. You need to redownload them when you show them again. This is not ideal, as it looks slow to the user and uses more data.
You can get around this a bit easier with a lazy image loader. This keeps the images in memory, but does not download them until necessary (i.e. they are shown on the screen)
Today, there are number of libraries that handle this exact issue, I found the Picasso
most convenient, I also wrote a blog post on this topic that I think you might find useful:
Guide: How to load images asynchronously into a ListView
You could could find there the most used libraries and code samples for how to use them.