How are you?
Using Jetpack Navigation, I cannot send the parameters from Child Fragment to Parent Fragment as the first information in Parent. The parameters are received according to LiveData. I'm trying to use: findNavController().currentBackStackEntry?.savedStateHandle?.getLiveData and also SharedViewModel with navGraphViewModels.
But since it's LiveData, the return is indetermined. So, sometimes they are called first, sometimes the UI is called first inside OnViewCreated, and after the methods above are called.
I need a way to always receive the parameters as the first thing when return to Parent to be possible to do some conditionals.
Is there a pattern for that? Thank you.
In order to receive the returned data, it is crucial to note that the Lifecycle must be in the RESUME state
Create extensions for the
FragmentChild fragment
Parent fragment
Hope it helps!