I'm using Paging library to load date directly from network. Do I have to implement logic to stop fetching data? In my case, that can be when received item count is lower than page size. Currently when I reach end of list lib keeps loading new pages.
Theoretically, PageKeyedDataSource has a result callback,
PageKeyedDataSource.LoadCallback
And that has an onResult
method, where the docs says
Pass an empty list if there is no more data to load.
Pass the key for the subsequent page to load to adjacentPageKey. For example, if you've loaded a page in loadBefore(LoadParams, LoadCallback), pass the key for the previous page, or null if the loaded page is the first. If in loadAfter(LoadParams, LoadCallback), pass the key for the next page, or null if the loaded page is the last.
So it says you should pass an empty list, and null
for adjacent page key, and it should work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With