0

I want to show only first few cards of the recyclerview and show a button such as load more or read more then on clicking on it show little more cards and so on.

What i have thought to do is making a button under recyclerview and making only first 4-5 cards in onbindViewholder() of adapter Visible and thus making other cards (or itemview as it is said in adapter class) invisible. But I don't think this would be a good approach.

Can someone suggest a good approach? I tried researching for hours, but haven't came across a near solution that is appropriate.

James Z
  • 12,209
  • 10
  • 24
  • 44
kloss91
  • 33
  • 1
  • 8
  • send to the adapter needed items quantity, and notify adapter by button click with an updated item list – Joao Dec 31 '17 at 13:04
  • yeah thanks, one more solution I came up with is giving int 5 to the adapter in constructor then returning it in getItemcount() method of the adapter then on button click incrementing it little more everytime. – kloss91 Dec 31 '17 at 13:23
  • if your server response has pagination, magic number 5 it's a bad approach – Joao Dec 31 '17 at 13:33
  • you have to set pagination on your server as well in you app. – Farhana Naaz Ansari Jan 01 '18 at 07:17

0 Answers0