简体   繁体   中英

Android listview load images only when the list items are shown

My android application has to show thumbnails of the audio file album art for each and every song. The mobile i'm testing on has about 2000 songs, so, I need to optimize the performance. There is a lot of lag if I use adapter's getview to load thumbnails.

So, to make it asynchronous I've added thread to load images, but it turns out 2000 threads are created to load all 2000 thumbnails.

Is there a way to optimize this? like lazy loading or live scrolling in android?

Update: Also, I'd like to get rid of the image thumb nails from the memory when scrolling as the number of images can cause OutOfMemory error.

Thanks.

This is lib u can use for lazy loading : Lib

  1. Will optimize ur thumbnail performance.

  2. Scroll listview smoothly

  3. u can run this lib in android and watch the performance.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM