0

So, i'm building an app. And i have to get data to recyclerView from Firestore. I don't want to use FirebaseUI but couldn't figure out the Pagination 3 for it aswell. There is only one Medium story about it, which didn't work for me. So, im confused.

If there is anyone who has done that before, i would love to hear how.

My Application uses MVVM, Hilt and Coroutines. But Flow is also okay.

  • I think you might be interested in this article, **[How to paginate Firestore using Paging 3 on Android?](https://medium.com/firebase-tips-tricks/how-to-paginate-firestore-using-paging-3-on-android-c485acb0a2df)**. – Alex Mamo Feb 02 '21 at 16:21
  • @Alex Mamo so yeah, i saw that. I'm following your YouTube channel aswell . But sadly, it didn't work for me. And there are no other tutorials or examples about it, AFAIK. –  Feb 02 '21 at 16:26
  • What do you mean by "it didn't work for me"? What's the issue, what exactly doesn't work? Have you tried to clone the repo, add some dummy data in Firestore, and lunch the app? – Alex Mamo Feb 02 '21 at 16:28
  • @Alex Mamo it doesnt give errors. But i think it doesnt get or populate the data. –  Feb 02 '21 at 16:31
  • If you don't have any data in the database, it won't work for sure. Try to add some Product objects to the products collection and it will work for sure. – Alex Mamo Feb 02 '21 at 16:34
  • No no, i have data at firebase. But okay, i will try to add more items later. Do i have to have more items then my page size? (15) –  Feb 02 '21 at 17:04
  • To be able to load more pages, you need to have more elements than the size of a single page. Also remember to have the same names for the properties in the class, as in the database. – Alex Mamo Feb 02 '21 at 17:07
  • Did you manage to implement the pagination? – Alex Mamo Feb 03 '21 at 04:46
  • im still trying –  Feb 03 '21 at 07:36
  • Ok, keep me posted. – Alex Mamo Feb 03 '21 at 07:36
  • Sadly, it wont work, i have no idea why. Looks like i will have to somehow figure it out alone. @Alex Mamo –  Feb 04 '21 at 21:13
  • @Alex Mamo is there any way to do it without data binding? –  Feb 05 '21 at 10:01
  • Sure there is, but using data binding is much simpler and cleaner. – Alex Mamo Feb 05 '21 at 12:06
  • Yes it is, but i didn't really used it, so, can you give a doc or source for non data binding ? –  Feb 06 '21 at 08:08
  • 1
    @Alex Mamo i did it, i just needed a empty constructor in data class hahah –  Feb 06 '21 at 10:18
  • Good to hear that, congrats ;) – Alex Mamo Feb 06 '21 at 10:24
  • 1
    Thanks! Your comments were really helpful –  Feb 06 '21 at 15:34

0 Answers0