-
Notifications
You must be signed in to change notification settings - Fork 10
Endless Loader
Prashant Solanki edited this page Dec 14, 2015
·
2 revisions
####Usage
Just call adapter.setEndlessLoader
. It take RecycelerView
,int
the item visibility threshold, EndlessLoader
as parameters.
Override loadMore
and onScrolled
.
-
loadMore
: is called when the threshold limit is reached. It's used to load data to the adapter. -
onScrolled
is the simpleOnScrollListener
method. You it as you please.
multiAdapter.setEndlessLoader(recyclerView, 5, new EndlessLoader() {
Handler handler = new Handler();
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
// Any other OnScrollListener implementation.
}
@Override
public void loadMore(final AbstractSnapMultiAdapter adapter,final int pageNo) {
Toast.makeText(adapter.getContext(),"Loading Page: "+pageNo,Toast.LENGTH_SHORT).show();
//Load More Data from DB or Do a network call.
}
});