The life cycle of a fragment:
1. Onattach (): When a fragment is associated with an activity is called
2. Oncreateview (): The view used to create fragmentation
3. Onactivitycreated (): Called when the active OnCreate () method returns
4. Ondestroyview (): Called when the fragmented view is removed
5. Ondetach (): Called when fragmentation is removed from an active association
Trigger:
1. When the fragment was created: Onattach () onCreate () Oncreateview () onactivitycreated ()
2. When debris is visible: OnStart () Onresume ()
3. Debris goes backstage: OnPause () onStop ()
4. Fragment destroyed (the activity being destroyed): OnPause () onStop () Ondestroyview () OnDestroy () Ondetach ()
5. As with activities, you can use the bundle object to restore a fragmented instance in the following states: OnCreate () Oncreateview () onactivitycreated ()
The life cycle of fragments in Android