Android Question CustomListView - "infinite" scroll?

jtare

Active Member
Licensed User
Longtime User
Like the title says, it is possible to create an infinite scroll effect? Using CustomListView?
I have more than 5000 items to fill the custom list view but loading them all at once will make the app crash and it won't even be possible because at 500 items the list start to have a lot of lag.
Even loading 30 items take a while in which the app is complete frozen, like 1-2 seconds.

So then I looked that apps like facebook, instagram, youtube,etc. have this effect of infinte scroll so it is possible but I don't know where to start, can someone point me in the right direction?
 

jtare

Active Member
Licensed User
Longtime User
Thanks for the reply.
I read the post but that is not the issue, I can handle that with no problem, the problem starts after loading 500+ items, then the scrollview will be with a lot of lag. I was thinking that maybe there is a way of free the memory by deleting the items that are off the screen and reload them when they are about to appear in the screen again, so I can "infinite" scroll 5000+ items, but I don't know how to do it or if its possible.
 
Upvote 0

eps

Expert
Licensed User
Longtime User
It might be worth you reading about ULV... or thinking about bump scrolling or paging... e.g. holding 2-3 'pages' in memory and loading these. As the User moves to a new 'page' you grab another one in that direction.

e.g.

Load pages 1, 2 and 3.

User moves to Page 2, nothing.

User moves to Page 3, Load Page 4, unload Page 1

User moves to Page 4, Load Page 5, unload Page 2

User moves back to Page 3, unload Page 5, Load Page 2

etc...


ETA : Actually, how are you populating the list and what are you displaying/listing? Is there any way to improve the data retrieval?
 
Upvote 0
Top