I am trying to use Android new Paging 3 Library in my app. I am fetching data from a backend API using Retrofit, which returns a list of objects. I need to know how to inform Pager to stop loading more data when the API returns an empty list.
Asked
Active
Viewed 1,758 times
2

Adrian Mole
- 49,934
- 160
- 51
- 83

Arpit Shukla
- 9,612
- 1
- 14
- 40
-
Hey Arpit, we'd love to hear if you can give us some more context to your problem. – Ryan Ward Valverde Sep 25 '20 at 08:29
1 Answers
14
When you have empty list, you should return nextKey = null
in LoadResult.Page(...)
to the Paging3 will know that there is no data further to load

i30mb1
- 3,894
- 3
- 18
- 34