user3849690
user3849690

Reputation: 105

Android Recycler View: How to stop loading of images when recycler view is scrolling and start loading only when scroll is stopped?

How to stop loading of images when recycler view is scrolling and start loading only when scroll is stopped?

Upvotes: 1

Views: 1009

Answers (2)

Shmuel
Shmuel

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

Rohit Sharma
Rohit Sharma

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

Related Questions