android-lifecycle icon indicating copy to clipboard operation
android-lifecycle copied to clipboard

Documented the case where a Fragment may rerun onAttach() and onCreate()

Open yorickhenning opened this issue 8 years ago • 0 comments

Documented the case where a Fragment is popped from a FragmentManager's back stack and reused. This causes the Fragment to recreate its child FragmentManager, reattach, and run onCreate() again.

It is not obvious that this might happen, but it can.

FWIW, this reinitialization causes the FragmentManager returned by Fragment.getChildFragmentManager() to change, making it unsafe to store the FragmentManager reference across this change in the Fragment.

yorickhenning avatar Sep 15 '17 23:09 yorickhenning