6

In Android docs, I found a specs on Activity lifecycle and on Fragment lifecycle individually, but never together. It does not seem obvious as I attached a debugger to FragmentActivity which hosts my fragment, and the life cycle is more than crazy. It looks like activity finishes first and then fragments starts, which is impossible.

Fragment's lifecycle


Activity's lifecycle


Logically, fragment should "jump into" activity's lifecycle after its onResume and it would end before activity's onPause, but it seems it is not happening.

Can someone either show me the lifecycle of the fragment in connection to its parent's activity or direct me to some good tutorial on this?

sandalone
  • 41,141
  • 63
  • 222
  • 338
  • 1
    Take a look at the video link, he explains about how activity lifecycle mingle with fragment lifecycle. This helped me hope others will be helped too. http://www.youtube.com/watch?v=vk7VKUFOlbY – mask Nov 10 '14 at 04:37
  • @mask this is great video! – sandalone Nov 10 '14 at 07:27

1 Answers1

1

Have you seen this? Fragment is created after Activity is created. It doesn't seem possible for "activity finishes first and then fragments starts" Can you post the code for that?
This is what I tested, 1 FragmentActivity , two Fragments :enter image description here

wtsang02
  • 18,603
  • 10
  • 49
  • 67
  • Sure I did, it is was the 1st doc. But they never made a connection to its parent's life cycle. It seems I would have to do it myself... – sandalone Dec 20 '12 at 13:20