Reputation: 1903
Please excuse my english... I'm French :)
I write this post because I have a little problem with my Android application ! I have got a listview, with images and text, and I want to load images ONLY when the user see the items.
For example:
Am I clear ?
Thanks for your help !
Upvotes: 1
Views: 977
Reputation: 4275
Use a lazyLoader as suggested by others. Additionally, use a gesture detector/listener. Don't call getImage/Bitmap methods of ImageLoaders for getting the images when the user flings.
How can you do this ?
Set a boolean in onFling of the gesture listener method, and reset it accordingly.
What do you achieve?
When the user performs a fling operation, you skip downloading images.
Alternative Accumulate requests and download after a delay of say 700 ms. Use a FIFO collection and the max size of the collection will be equal to the number of items visible. Reset(further delay) the download request if the user scrolls.
I prefer the 1st approach. Will post some code if I get time.
Upvotes: 1
Reputation: 3714
You should create a custom listview adapter you have a lot of examples in internet, for example: asynchronous image listview or multithreading-for-performance or the thread: Load asynchronous images in listView
Upvotes: 0
Reputation: 432
use the concept of lazyLoader as u had to add jar file of lazy loader too
in listview there is property as smoothscroll set it true.
Upvotes: 0