I have been facing issues while using live data and shared view model as a medium to interact between my fragments and activity. Here is the issue..
Activity A (Has a view model X shared across two fragments)
---Displays----> Fragment A on startup (dashboard type of view) --- on select in A (viewmodel updated)--> Live data Triggered
--view model X in the activity observes changes and adds Fragment B dynamically to the back stack--> Fragment B is active now.
Couple of issues, that I'm facing
I see that, on back press from fragment B, back to Fragment A and vice versa, the previous value of the livedata is observed at the beginning before fetching the latest data.
On rotation/ state change, my activity observes for the fragment changes the second time ( kind of same as above)
Any workaround for this ? or is there anything that i'm missing
Thanks in advance..