Reputation: 4482
Hey so I have done a bit of research, and want to display my images in my gridview and listview dynamically where it keeps loading as people scroll down, without lagging.
I currently found a bunch of resources on here that I am trying to implement, but seeing that some of them were posted 3 years ago, I am trying to see what is the most efficient way to implement it now?
These are two libraries I ran into if anyone has a suggestion on using them?
Otherwise I was thinking of implementing something like this and downloading the image on another thread somehow...
list.setOnScrollListener(new OnScrollListener() {
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
if(firstVisibleItem+visibleItemCount == totalItemCount && totalItemCount!=0)
{
if(flag_loading == false)
{
flag_loading = true;
additems();
}
}
}
});
I also found these tutorials, just unsure what is still relevant or if there is a more practiced method currently:
Upvotes: 0
Views: 57
Reputation: 7592
Android itself doesn't help you with this at all. I would highly recommend using square's Picasso library. It will handle all of your gridview recycling and make it buttery smooth. We use it for all of our projects (see JackThreads on the playstore) and love it. http://square.github.io/picasso/
Upvotes: 1