Fixed
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Looks like it's related to https://cs.android.com/androidx/platform/frameworks/support/+/d7f5e8294c72d753234ff82e868cd09a06241c5e - When destroying the fragment view, moveToState is called and ends up re-creating the fragment view now that check has been removed
il...@google.com <il...@google.com> #3
Seems like this is already fixed in master as a side effect of
You'd want to add the snapshot repository to your repositories
block:
maven {
url "https://ci.android/com/builds/submitted/6080026/androidx_snapshot/latest/repository/"
}
then switch to androidx.fragment:fragment-ktx:1.3.0-SNAPSHOT
.
We'll look into cherry picking the changes into Fragment 1.2.0
an...@google.com <an...@google.com> #4
I can confirm that the issue appears to be fixed in that snapshot. Thanks!
Description
Version used: 1.2.0-rc02
When the FragmentActivity hits onSaveInstanceState(), FragmentActivity moves all of the FragmentManagers to STOPPED, as expected.
However, it is expected that Lifecycle changes are always nested:
- Parent ON_START
- Child ON_START
- Parent ON_RESUME
- Child ON_RESUME
---
- Child ON_PAUSE
- Parent ON_PAUSE
- Child ON_STOP
- Parent ON_STOP
But in the case of onSaveInstanceState() it appears that the markState() method stops the parent Fragments first before the children, breaking the nesting guarantee.
You can verify the correct ordering by calling remove on the parent Fragment - you'll see the proper nesting there.