Hey. I'm using a MVVM viewmodel class which succes...
# android
a
Hey. I'm using a MVVM viewmodel class which successfully retains list data for a RecyclerView after a configuration change. However, the previous RecyclerView position is not restored. What would be a good way to solve this?
i
Generally that means you actually haven't set that data on your adapter before you set the adapter on your RecyclerView. You might look at the blog post: https://medium.com/androiddevelopers/restore-recyclerview-scroll-position-a8fbdc9a9334
a
I saw that blog post, but it just got me more confused. From what I understand on configuration change the livedata that was being observed gets a callback. That callback is where I set my adapter data. But it seems the callback happens after the onCreate() function where I set my recyclerview adapter. https://pastebin.com/aRFzW9FY