I'm trying to implement a list/detail UI in Android by using:
- paging3 with cache backed by room db
- navigation with
navigation-safe-args-gradle-plugin
- RxJava3
The list view is generally working fine. I also added refresh functionality by calling pagingAdapter.refresh()
, which is also working fine.
The problem occurs when navigating to the detail view by clicking on an item in the list and then navigating back by pressing the back button. After that, the paging seems stuck - the easiest way to see this is by pressing the refresh button, which does nothing (and was working fine before navigation). As far as I can tell, no error gets thrown.
As for debugging, I can confirm that the pagingAdapter.refresh()
is definitely called, but the loadSingle
method in RxRemoteMediator
is not called.
I put together an example where this issue occurs: https://github.com/urbim/PagingTest
My best guess is that this is a lifecycle issue, but I can't figure out where.