I am implementing endless recycler view. Data is getting fine from server aslo scroll down getting down and show it. But on scroll it automatically comes to top again and again. I implemented number of solutions but doesn't work. Here is bit of code.
private int postNo = 15;
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
if (!lastTime) {
if (dy > 0) { // check for scroll down
visibleItemCount = layoutManager.getChildCount();
totalItemCount = layoutManager.getItemCount();
pastVisibleItems = ((GridLayoutManager) recyclerView.getLayoutManager()).findFirstVisibleItemPosition();
if ((visibleItemCount + pastVisibleItems) >= totalItemCount) {
postNo = postNo + 15;
getDataFromUrl(postNo);
}
}
}
}
What I want is when I scroll down app increase num of items and it should scroll fine.
www.............." + postNo";