testivanivan
testivanivan

Reputation: 1514

Android. How to load paging data from specific position with Paging 3?

I'm using paging3 for showing endless list in RecyclerView. When I click in specific item I need to show detail fragment. The detail fragment contains a view pager whose adapter is also PagingDataAdapter. That is, a fragment with detailed information should show the element that I selected on the previous screen and it is also possible to scroll horizontally to other elements that are also loaded page by page. The problem is that I can't start displaying the paging list in my view pager from a certain position. The list is always displayed from the beginning. I can't found solution for this. Is it possible to start listening to data from Page Source (RemoteMediator) beginning from specific position ? Please, help me:(

Upvotes: 8

Views: 1818

Answers (1)

Tangerine
Tangerine

Reputation: 11

you can find the LimitOffsetPagingSource and check the getRefreshKey. i guess the getRefreshKey return a wrong key by PagingState.anchorPosition because you set a Pager.initialKey

Upvotes: 1

Related Questions