diff --git a/complete_android_fragment_lifecycle.dia b/complete_android_fragment_lifecycle.dia index 663031b..b4b256d 100644 --- a/complete_android_fragment_lifecycle.dia +++ b/complete_android_fragment_lifecycle.dia @@ -1576,7 +1576,7 @@ shut down# - + @@ -2639,7 +2639,7 @@ layout# - + @@ -2672,7 +2672,7 @@ layout# - + @@ -2970,7 +2970,7 @@ layout# - + @@ -3003,7 +3003,7 @@ layout# - + @@ -3147,7 +3147,7 @@ layout# - + @@ -3180,7 +3180,7 @@ layout# - + @@ -3663,7 +3663,7 @@ layout# - + @@ -3897,7 +3897,7 @@ and reattachment, not restart# - + @@ -4008,7 +4008,7 @@ killed# - + @@ -4236,7 +4236,7 @@ to the activity# - + @@ -4272,7 +4272,7 @@ to the activity# - + @@ -4312,7 +4312,7 @@ to the activity# - + @@ -4476,7 +4476,7 @@ to the activity# - + @@ -4518,7 +4518,7 @@ removed/replaced# - + @@ -4638,7 +4638,7 @@ removed/replaced# - + @@ -4680,7 +4680,7 @@ back stack# - + @@ -4719,7 +4719,7 @@ in many apps# - + @@ -4759,7 +4759,7 @@ onUserInteraction() is called first# - + @@ -4800,7 +4800,7 @@ activity.# - + @@ -4840,7 +4840,7 @@ you launched exits# - + @@ -4875,7 +4875,7 @@ https://github.com/xxv/android-lifecycle# - + @@ -4911,7 +4911,7 @@ https://github.com/xxv/android-lifecycle# - + @@ -4985,7 +4985,7 @@ https://github.com/xxv/android-lifecycle# - + @@ -5065,7 +5065,7 @@ https://github.com/xxv/android-lifecycle# - + @@ -5105,7 +5105,7 @@ reattached# - + @@ -5138,7 +5138,7 @@ reattached# - + @@ -5171,7 +5171,7 @@ reattached# - + @@ -5204,7 +5204,7 @@ reattached# - + @@ -5237,7 +5237,7 @@ reattached# - + @@ -5270,7 +5270,7 @@ reattached# - + @@ -5348,7 +5348,7 @@ view hiearchy# - + @@ -5387,7 +5387,7 @@ view hiearchy# - + @@ -5396,7 +5396,7 @@ view hiearchy# - + @@ -5438,14 +5438,14 @@ library.# - + - + - - + + @@ -5472,14 +5472,14 @@ library.# - + - + - - + + @@ -5509,7 +5509,7 @@ library.# - + @@ -5606,7 +5606,7 @@ retainInstance# - + @@ -5615,7 +5615,7 @@ retainInstance# - + @@ -5657,14 +5657,14 @@ onDestroy()# - + - + - - + + @@ -5691,14 +5691,14 @@ onDestroy()# - + - + - - + + @@ -6043,7 +6043,7 @@ onDestroy()# - + @@ -6078,5 +6078,71 @@ setHasOptionsMenu(true)# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #The Fragment +is popped from +a FragmentManager's +back stack and +added again, to either +the same or a different +FragmentManager# + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/complete_android_fragment_lifecycle.pdf b/complete_android_fragment_lifecycle.pdf index 3addd8f..91b3728 100644 Binary files a/complete_android_fragment_lifecycle.pdf and b/complete_android_fragment_lifecycle.pdf differ diff --git a/complete_android_fragment_lifecycle.png b/complete_android_fragment_lifecycle.png index 259990e..3a0b6ce 100644 Binary files a/complete_android_fragment_lifecycle.png and b/complete_android_fragment_lifecycle.png differ diff --git a/complete_android_fragment_lifecycle.svg b/complete_android_fragment_lifecycle.svg index 8b9037e..0f7a657 100644 --- a/complete_android_fragment_lifecycle.svg +++ b/complete_android_fragment_lifecycle.svg @@ -1,2745 +1,849 @@ - - - - - - - image/svg+xml - - - - - - - - - - - - onAttach() - - - Fragment is - added to - existing activity - - - onCreate() - - - onCreateView() - - - onActivityCreated() - - - onStart() - - - onResume() - - - Fragment is - active - - - onPause() - - - onStop() - - - onDestroyView() - - - onDestroy() - - - onDetach() - - - Fragment is - destroyed - - - Activity is - launched - - - onCreate() - - - onResume() - - - onPause() - - - onStop() - - - onStart() - - - onViewCreated() - - - Activity is - running - - - onDestroy() - - - Activity is - shut down - - - onRestart() - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - onViewStateRestored() - - - onInflate() - - - Fragment is - inflated from - layout - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Fragment Lifecycle - Activity Lifecycle - - - onActivityResult() - - - - - - onAttachFragment() - - - onContentChanged() - - - - - - - - - onUserInteraction() - - - onUserLeaveHint() - The Complete Android Activity/Fragment Lifecycle - - - onPostCreate() - - - - - - onPostResume() - - - - - - - - - - - - onSaveInstanceState() - - - - - - - - - - - - - - Only called upon fragment creation - and reattachment, not restart - - - - - - - - - - - - - - - - - Apps with higher priority - need memory - - - App process - killed - - User navigates - to the activity - - - - - Common - - - Uncommon - - - Conditional - Key - - User navigates - to the activity - - User returns - to the activity - - - - - - - - - - - - - - User navigates - backward or - fragment is - removed/replaced - - Fragment is - added to the back - stack, then - removed/replaced - - - - - - - - The fragment - returns to the - layout from the - back stack - Uncommon lifecycle - events are ones that - either the documentation - states are not intended for - application use or which - aren't often encountered - in many apps - - Only called when - onUserInteraction() is called first - - Called when the user - interacts with the - activity. - - Called when an activity - you launched exits - v0.9.0 2014-04-22 Steve Pomeroy <stevep@thelevelup.com> - CC-BY-SA 4.0 - https://github.com/xxv/android-lifecycle - - - - - ☑ retainInstance - - - - - the fragment is - reattached - Attached: fragment is - associated with an activity - Added: fragment is in the - view hiearchy - - - - - ☑ retainInstance - - - - Things get a little - weird here if you're - using the v4 compat - library. - - - - - - - - - retainInstance - - - onSaveInstanceState() - - - - This method - may be called at - any time before - onDestroy() - - - - - - - - - onAttachedToWindow() - - - onCreateOptionsMenu() - - - onRestoreInstanceState() - - - onPrepareOptionsMenu() - - - onCreateOptionsMenu() - - - onPrepareOptionsMenu() - - Only called if - setHasOptionsMenu(true) + + + + + + + + + onAttach() + + + + + + + Fragment is + added to + existing activity + + + + + + + onCreate() + + + + + + + onCreateView() + + + + + + + onActivityCreated() + + + + + + + onStart() + + + + + + + onResume() + + + + + + + Fragment is + active + + + + + + + onPause() + + + + + + + onStop() + + + + + + + onDestroyView() + + + + + + + onDestroy() + + + + + + + onDetach() + + + + + + + Fragment is + destroyed + + + + + + + Activity is + launched + + + + + + + onCreate() + + + + + + + onResume() + + + + + + + onPause() + + + + + + + onStop() + + + + + + + onStart() + + + + + + + onViewCreated() + + + + + + + Activity is + running + + + + + + + onDestroy() + + + + + + + Activity is + shut down + + + + + + + onRestart() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + onViewStateRestored() + + + + + + + onInflate() + + + + + + + Fragment is + inflated from + layout + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Fragment Lifecycle + + + Activity Lifecycle + + + + + + onActivityResult() + + + + + + + + + + + + onAttachFragment() + + + + + + + onContentChanged() + + + + + + + + + + + + + + + + + + + + + + + onUserInteraction() + + + + + + + onUserLeaveHint() + + + + + + + The Complete Android Activity/Fragment Lifecycle + + + + + + onPostCreate() + + + + + + + + + + + + onPostResume() + + + + + + + + + + + + + + + + + + + + + + onSaveInstanceState() + + + + + + + + + + + + + + + + + + + + + + + + + + Only called upon fragment creation + and reattachment, not restart + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Apps with higher priority + need memory + + + + + + + App process + killed + + + + + + User navigates + to the activity + + + + + + + + + + + Common + + + + + + + Uncommon + + + + + + + Conditional + + + + Key + + + + + User navigates + to the activity + + + + + + User returns + to the activity + + + + + + + + + + + + + + + + + + + + + + + + + + User navigates + backward or + fragment is + removed/replaced + + + + + + Fragment is + added to the back + stack, then + removed/replaced + + + + + + + + + + + + + + + + The fragment + returns to the + layout from the + back stack + + + + Uncommon lifecycle + events are ones that + either the documentation + states are not intended for + application use or which + aren't often encountered + in many apps + + + + + Only called when + onUserInteraction() is called first + + + + + + Called when the user + interacts with the + activity. + + + + + + Called when an activity + you launched exits + + + + v0.9.0 2014-04-22 Steve Pomeroy <stevep@thelevelup.com> + CC-BY-SA 4.0 + https://github.com/xxv/android-lifecycle + + + + + + + + + + + + + + + + ☑ retainInstance + + + + + + + + + + + the fragment is + reattached + + + + + + + + + + + + + + + + + + + Attached: fragment is + associated with an activity + + Added: fragment is in the + view hiearchy + + + + + + + + + + ☑ retainInstance + + + + + + + + Things get a little + weird here if you're + using the v4 compat + library. + + + + + + + + + + + + + + + + + retainInstance + + + + + + + onSaveInstanceState() + + + + + + + + This method + may be called at + any time before + onDestroy() + + + + + + + + + + + + + + + + + onAttachedToWindow() + + + + + + + onCreateOptionsMenu() + + + + + + + onRestoreInstanceState() + + + + + + + onPrepareOptionsMenu() + + + + + + + onCreateOptionsMenu() + + + + + + + onPrepareOptionsMenu() + + + + + + Only called if + setHasOptionsMenu(true) + + + + + + + The Fragment + is popped from + a FragmentManager's + back stack and + added again, to either + the same or a different + FragmentManager + +