Skip to content Skip to sidebar Skip to footer

Nested Observers With Livedata (observing An Observer)

I have a case where I have BottomNavigationView where fragments are shown/hidden instead of adding/replacing, therefore they do not go through their lifecycle every time. Fragment

Solution 1:

LiveData 1 is to tell me when it's onChanged method has been triggered, then I want to execute the onChanged of LiveData 2

That actually sounds like it's just

Transformations.switchMap(liveData1, (x) -> { return liveData2; })
                 .observe(...

Post a Comment for "Nested Observers With Livedata (observing An Observer)"