I'm migrating to ViewPager2. In my fragments, I have data on these pages that are dynamic and could be changed depending on what has happened on other pages. Currently, I'm updating the data in the onResume() of my fragments. In ViewPager 1, the fragments would be re-created before reaching a page so I wasn't running into the issue of having to use onResume() to update data. I would like to update the data before it reaches the page in order to avoid this "lag" update. I have tried using LifecycleObserver in order to track when ON_RESUME event is called. But it's being called after onResume() is called.
Asked
Active
Viewed 185 times
0
-
Use a shared viewmodel to achieve that simply! – Malik Bilal Dec 09 '21 at 19:46
-
@MalikBilal That seemed to be the move. Thank you. – dman224 Dec 15 '21 at 17:22