Skip to content

Instantly share code, notes, and snippets.

@ishaileshmishra
ishaileshmishra / EndlessRecyclerOnScrollListener.java
Created February 19, 2019 06:37 — forked from pratikbutani/EndlessRecyclerOnScrollListener.java
Endless RecyclerView OnScrollListener for pagination
public abstract class EndlessRecyclerViewScrollListener extends RecyclerView.OnScrollListener {
// The minimum amount of items to have below your current scroll position
// before loading more.
private int visibleThreshold = 5;
// The current offset index of data you have loaded
private int currentPage = 0;
// The total number of items in the dataset after the last load
private int previousTotalItemCount = 0;