2

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.

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
Arpit Shukla
  • 9,612
  • 1
  • 14
  • 40

1 Answers1

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