1. Process throughout the cycle:
1. OnCreate (): Called when you create the activity for the first time . You can set the static code here, create the View,
Binds the data to the list.
1.1 Onrestart (): called after your activity is in the onStop state
1.2onStart (): When the activity is becoming a visualization
1.2.1 Onresume (): this activity interface communicates with the user ( focus position )
1.2.2 OnPause (): This interface is in the secondary view, not the focus position, still visible
1.3onStop (): in an invisible state.
2. OnDestroy (): you call the finish () method to destroy the activity, or if other programs require memory, it is
Automatically destroyed, you can use the isfinishing () method to distinguish between the two cases.
2.Actvity Stacks
The state of each actvity is determined by the position in the activity stack in which it is located, and all currently running actvity will follow the principle of LIFO.
3.Activity status
As the activity is created and destroyed, it goes in and out of the stack as shown, which may experience the following four states:
Active state: In the most current location, with focus, the system sacrifices all resources including other activity (non-active) to guarantee its operation.
Paused state: Not completely missing, just a small part appearing in front.
Stopped state: Completely invisible, completely obscured when the activity is in the Stopped state, be sure to save the current data and the current UI state.
Otherwise, when activity exits or shuts down, the current data and UI state is lost.
Inactive Status: The activity was killed or was started before it was in inactive state. The activity has been removed from the activity stack and needs to be restarted before it can be displayed and used.
4.Task
It is a stack that stores multiple activity.
Feature One:
It is a stack that stores multiple Activity.
Feature two:
Multitasking features (multitask):
When the user presses the Home button to return to the top,android can set up multiple Task
While in the background, all Activity remains in stopped state. Unless memory is insufficient,
Destroy part of the activity.
Feature three:
How to protect the state of your activity ( because it is possible, in memory, the system will destroy your activity )
In case of this, you should keep the activity information in Onsaveinstancestate () .
Activity after being destroyed, the system will still remember it once in this Task position in the room.
More managing Tasks, you can go to see docs, for example : How to get Activity Start another taskinstead ofreplacing the original task ;
How to make Activity re-open an existing Task one of the underlying Activity , instead of recreating Activity ; how to make Activity
Destroy a Task under the all Activity , except for the lowest Activity .
These operations are available through the properties of activity (attribute), and the Intent flag to achieve .
Android activity life cycle "graphics"