Fixed
Status Update
Comments
il...@google.com <il...@google.com>
ap...@google.com <ap...@google.com> #2
It is not possible for the view of the NavHostFragment to be available in the onCreate() of the Activity. In this case, the NavHostFragment lifecycle method follows the Activity lifecycle methods directly therefore, when the activity is on onCreate() so is the NavHostFragment. However, if the Fragment Lifecycle was driven with a LifecycleObserver (https://issuetracker.google.com/issues/127528777 ), onCreate() could be dispatched for a Fragment separately from the onCreate() for an Activity (or a parent Fragment if using a child Fragment). This means that if you were using a LifecycleObserver, it would be possible for the views to be available when onCreate() is dispatched and findNavController() would work in the LifecycleObserver's onCreate().
This is being tracked byhttps://issuetracker.google.com/issues/143145612 .
This is being tracked by
Description
Version used: 1.2.0-rc03
In the rare case where a retained fragment is added after the state is saved (specifically, in the case covered by the restoreRetainedInstanceFragmentWithTransparentActivityConfigChange test), we need to ensure that the retained fragment is both destroyed (which we do already) *and* removed from the list of retained fragments.
If the fragment is not removed from the list of retained fragments, it is recreated after each config change, only to be immediately destroyed again.