3

I have following scenario:

  1. When I launched the activity I need to load some data.
  2. The activity has refresh button which will load new data from the network. This will be a new list of data which will not match to the initial list.
  3. Now suppose user has scrolled down to page 6 before hitting refresh button. Now when user hits refresh how to update the whole list and jumping to the position 0 first page.

I tried below steps but did not get any success:

  1. Used InvalidatingPagingSourceFactory and invalidating it before calling adapter?.refresh()
  2. Tried to set nextpage to 0 when calling adapter?.refresh() but this also did not work.

Everytime data gets updated but recyclerview position is maintained. Please help. I want my recyclerview to point to the first item whenever I fill new data.

0 Answers0