0

I have a recycler view that loads more content when users scroll to the bottom.

To scroll to the bottom once, I can use something like: recyclerView.smoothScrollToPosition(adapter.getItemCount() - 1)

Is it possible to continually scroll the recycler view until it reaches the very end? The recycler view does not have thousands of items so it'll only have to scroll a few times before it reaches the end.

Rgfvfk Iff
  • 1,269
  • 15
  • 36

1 Answers1

0

You can easily do this by the following logic:

  1. Scroll your Recycler view to bottom once as per your needs.
  2. As per your response from the server maintain a value which tells if there is more data available for the user. Value can be like 0 or 1.

    0: No more data is available for the user.
    1: More data is available for the user.

  3. If more data is available for the user then after the data is set on the screen again scroll user to bottom of the Recycler View else don't scroll.

Tip: Maintain a delay of about 200-300ms or 500ms(fail safe) after your data is set on the screen and before scrolling to bottom to avoid any errors or crashes.

Hope this helps.

nimi0112
  • 1,753
  • 1
  • 13
  • 29