Search code examples
androidandroid-listviewandroid-imageviewandroid-tablelayout

Images take a moment to reappear when scrolling back to them in a ListView


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?


Solution

  • 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)

    There is a sample here.