Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android recyclerview load more button [closed]

Is there a tutorial/example to include a load more button with recyclerview? I need to add a button after displaying 8 elements in the recyclerview. The user can click this button to load the next 8 contents.

like image 456
Sammys Avatar asked May 18 '15 21:05

Sammys


People also ask

How to add load more button in RecyclerView android?

Navigate to the app > res > layout > Right-click on it > New > Layout Resource File and name it as course_rv_item and add the below code to it.

How do I stop refreshing RecyclerView data scroll to top position android?

Make a setDataList method in your adapter class. And set your updated list to adapter list. And then every time of calling API set that list to setDataList and call adapter. notifyDataSetChanged() method of your adapter class.

When to use Recycler View?

RecyclerView is powerful when you need to customize your list or you want better animations. Those convenience methods in ListView caused a lot of trouble to people which is why RecyclerView provides a more flexible solution to them. The major change you need to make for migration is in your adapter.

Why use RecyclerView in android?

RecyclerView makes it easy to efficiently display large sets of data. You supply the data and define how each item looks, and the RecyclerView library dynamically creates the elements when they're needed. As the name implies, RecyclerView recycles those individual elements.


2 Answers

Add a footer view to your recyclerview which includes Load More button. When clicking the button, make a request for next 8 items. After loading items, notify the adapter.

RecyclerView header and footer

like image 98
Oğuzhan Döngül Avatar answered Nov 14 '22 21:11

Oğuzhan Döngül


what you need is endless recycler view ,which will load the data while scrolling . Here I have attached link for that implementation.

Follow this link

like image 37
Amarpreet Singh Avatar answered Nov 14 '22 21:11

Amarpreet Singh