Reputation: 105
How to stop loading of images when recycler view is scrolling and start loading only when scroll is stopped?
Upvotes: 1
Views: 1009
Reputation: 3916
The question is slightly unclear, but I'm going to assume that you are talking about loading images into an imageview in recyclerview/listview items.
Answer: Don't do it by hand. Use a library (like Glide) to load the images for you.
Upvotes: 0
Reputation: 2007
A common application feature is to load automatically more items as the user scrolls through the items (aka infinite scroll). This is done by triggering a request for more data once the user crosses a threshold of remaining items before they've hit the end.
The approaches for ListView, GridView and RecyclerView (the successor to ListView) are documented here. Both are similar in code except that the LayoutManager in the RecyclerView needs to be passed in to provide the necessary information to implement infinite scrolling.
Follow this link for more implementation details:
https://guides.codepath.com/android/Endless-Scrolling-with-AdapterViews-and-RecyclerView
Upvotes: 1