Skip to content

Quick start with Load More Indicator

Vitaly Vivchar edited this page Nov 5, 2017 · 6 revisions

To add the LoadMore support:

1. Register the LoadMoreViewRenderer in your adapter

    ...
    mRecyclerViewAdapter.registerRenderer(new LoadMoreViewRenderer(R.layout.your_load_more_layout, this));
    ...

2. Create a EndlessScrollListener or use any other

for example: https://stackoverflow.com/a/29893272/4894238

3. Add call of the showLoadMore method

   mRecyclerView.addOnScrollListener(new EndlessScrollListener() {
      @Override
      public void onLoadMore(final int page, final int totalItemsCount) {
          mRecyclerViewAdapter.showLoadMore();
          //send request to a server
      }
   });

4. When a response will be received just call the setItems

The Load More Indicator will be hidden automatically

    ...
    public void updateList(List<ItemModel> list) {
        mRecyclerViewAdapter.setItems(list);
    }
    ...

If you need you can manually hide the Load More Indicator:

    ...
    mRecyclerViewAdapter.hideLoadMore();
    ...