Can any one draw the life cycle of a fragment and its parent FragmentActivity?

In Android docs, I found specifications in the Activity life cycle and in the Fragment life cycle individually, but never together. This does not seem obvious, since I attached a debugger to FragmentActivity , which contains my fragment, and the life cycle is more than crazy. It seems that the activity ends first, and then the fragment begins, which is impossible.

Fragment life cycle


Activity Life Cycle


Logically, the fragment should β€œjump into” the activity life cycle after its onResume , and it ends before the onPause action, but this does not seem to happen.

Can someone show me the life cycle of a fragment in relation to its parental activity or direct me to a good guide on this?

+6
source share
1 answer

Have you seen this ? The fragment is created after the Activity is created. It does not seem possible that "processing begins first, and then the fragment begins." Can you post the code for this?
This is what I tested, 1 FragmentActivity, two snippets: enter image description here

+1
source

All Articles