I am trying to write code for endless scrolling in a recycler view. This is the snippet that gives me a compiler error:
@Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { visibleItemCount = mLayoutManager.getChildCount(); totalItemCount = mLayoutManager.getItemCount(); pastVisiblesItems = mLayoutManager.findFirstVisibleItemPosition(); if ( (visibleItemCount+pastVisiblesItems) >= totalItemCount) { Log.v("...", "Last Item Wow !"); }
And the declaration I wrote earlier:
mLayoutManager = new LinearLayoutManager(this);
And mLayoutManager is an object of the RecyclerView.LayoutManager class
android android-recyclerview
Vedant261 Mar 29 '15 at 8:14 2015-03-29 08:14
source share