I have a ListView that display Bitmap pictures. These Bitmaps get to be quite large. When i scroll on the ListView it seems to be very heavy. What techniques can i use to optimize the ListView ? This may cover compressing the Bitmap in memory, or ways to enhance the List View memory management ?
Share
First, read this,
It talks about the view holder pattern, and loading images in a threads. also, read this,
This talks about how to build an efficient memory cache for bitmaps.
If that’s not enough, another technique you can employ is to avoid loading images until scrolling stops. This prevents the listview from loading all of the images if the user say flings to the bottom of the list. Basically, something like this,
This requires that you keep a handle to the
ImageViewfor each item in your adapter, so you can find it later and set the appropriate bitmap into it. This could be as simple as keeping an array of image views in your adapter, where the index == the position in the list view.