0

How do I invoke to load the next page to append my database when I reached the last item on

val lazyPagingItems = viewModel.getAllItems().collectAsLazyPagingItems()
Arthur
  • 318
  • 1
  • 4
  • 11

2 Answers2

2

Automatic loading of more items when you reach the end of the list is part of paging. Here's an article you can read that will show you the steps:

List view with Pagination using Jetpack Compose

Johann
  • 27,536
  • 39
  • 165
  • 279
  • can I make the Paging3 load more items only when I've reached the end of the list? or does it do that automatically? – Arthur Nov 23 '21 at 07:08
  • 1
    It automatically loads more items BEFORE you reach the end of the list or the top of the list (when scrolling up). – Johann Nov 23 '21 at 07:29
1

As @Johann already mentioned in his answer, the mechanism to load more pages are present in the Paging library. If you consider at some point in time trying using Cloud Firestore, then for sure the following article will help:

And here is the corresponding repo.

Alex Mamo
  • 130,605
  • 17
  • 163
  • 193