RecyclerView Endless Load More Example Project. [GitHub Source]

In this post I included an easy approach to implement the Endless Load more with loading progress in RecyclerView. I made this project as simple as possible, The main view lists movie names with IMDB rating (loads from server). When you reach the bottom by scrolling down the list, app will load more movies by indicating a loading progress.

– PHP Source added

For Network Requests I used Retrofit/OkHttp in this project. Even the project included Retrofit, I will skip that part in this post as this post mean to RecyclerView load more implementation. Full source code available at Github you can download and use the code as you wish.

RecyclerView is the Advanced and Flexible version of ListView which handles large datasets efficiently by maintaining a limited number of views (Like the ViewHolder Pattern used in ListView ). You can use the same RecyclerView for list and Grid type views by the setting the RecyclerView.LayoutManager.

As we are implementing RecyclerView Load More I assume you have created the project and have enough knowledge on RecyclerView layout and required dependencies. Else read here to get the basic understanding.

OK Let’s start … Below is the final RecyclerView adapter class I used in this project look at code, I will explain the required blocks separately.

– It has two View Types (Movie[title,rating] and Loading Progress)

MovieModel a data model class which have title,rating and type

– boolean isLoading is used to set the loading and load completed status. Which will prevent unnecessary the back to back load more call.

– you should call the custom method notifyDataChanged() to handle the isLoading status

– boolean isMoreDataAvailable is used to set the server data availablity status. Which will prevent app from requesting when no more data available at the server. Call adapter.setMoreDataAvailable(false); to notify the adapter that there is no more data available at the server.

interface OnLoadMoreListener has a callback method onLoadMore which will get called whenever the scroll reached at the bottom.

Below is the example code block I used to call the load more in Activity class.

– In main activity implements OnLoadMoreListener() to get callback when scroll reaches the bottom.

– In loadMore() remote request method I adds loading progress view to the bottom of list by setting the MovieModel type to load.

– In data response callback removes the added load type from the MovieModel list, then adds the server response to the current list. When server returns blank array sets adapter.setMoreDataAvailable(false) to prevent further requests.

That’s it… For further reference checkout the full source code at GitHub.




39 thoughts on “RecyclerView Endless Load More Example Project. [GitHub Source]

    1. Are you using the isLoading variable in your adapter. boolean isLoading status prevent back to back calling. Also call adapter.setMoreDataAvailable(false); after you load all the contents from remote or any other source.

    1. In MainActivity when we get result from server I am checking the result array size, if size ==0 sets adapter.setMoreDataAvailable(false); this will stop any further request to server. Also in your php if the data finished echo a blank array in json encode. that’s it.

  1. if i wants this type of data using this code then..

    “status”: true,
    “message”: “”,
    “arts”: {
    “list”: [
    “artist”: “Nehal”,
    “art_id”: “355”,
    “title”: “Test upload art”,
    “description”: “Large size shirt”,
    “created_date”: “14-09-2016”,
    “price”: “0.61”,
    “status”: “ACCEPTED”,
    “size_description”: “Large size shirt”,
    “category”: “Abstract Art”,
    “size”: “Large”

  2. Can we have php construction, how you limited the row in your php query and continue loading more. Plz… share you php file not json result.

    1. I am not querying from db so there is no use with my php file.

      To Query from server use this method.
      1. First query first 10 rows in desc order (Or you can use any number of rows you wish to show)… If selected rows count > 0 json encode the rows else json encode a blank array…
      2. when scroll reach the end … while calling load more send last row id…
      3. In server side get the id and query next 10 rows less than the the id you get from the request.. If selected rows count > 0 json encode the rows else json encode a blank array…

      That’s it.

      1. Dear Muslim Brother Muhammad, since you know programming and your code better than us, I would really like you to write one php file to connect with mysql database and show us to constract ours similar to yours. If we knew the way you did we woldn’t visit your site and spend our precious time for your tutorial. Please help us. Waiting for your soonest solution.

  3. Progress bar is not showing, even though i call loadMore method in I found getItemView return TYPE_LOAD is never invoked until all data are loaded.

  4. Hi

    I have a problem with loading new list elements.
    It goes like this:
    Then it deletes 10 and overlaps it with 11, and tham happens every time I load new 10 items.


  5. Everything works fine but progress bar not get hidden after get everything get loaded in the middle progress bar still showing.

  6. my recyclerview has imageview that change in any item. when scroll imageview is changed and dosent correct imageview.
    ho to solve this problem

  7. Hi.I got below error when I scrolled:
    Cannot call this method while RecyclerView is computing a layout or scrolling{3370930 VFED.V… ……ID 0,147-1080,1731 #7f0900c4 app:id/recycler_list},….

  8. I get error message in line:
    listCoachsAdapter.notifyItemInserted(coachModel.size()-1 );

    Cannot call this method while RecyclerView is computing a layout or scrolling

Leave a Reply

Your email address will not be published. Required fields are marked *

five + 9 =