Keywords: application components, four components, user interface, interaction .
An was an Activity application component that provides a screens with which users can interact in order to do something
Each Android app opens, and generally has an interface to interact with the user to complete input, output, and other functions. One of the four components of Android that provides this functionality isActivity.
Activity provides a window depicting the user interface, the size of the window can be: full screen window, floating window, embedded in other activity (using Activitygroup).
An app typically contains multiple activity, and each activity is designed around a specific kind of action that the user can perform, and other activity can be turned on.
As shown in, the activity in the Chrome app.
- activity and fallback stack (back stack)
The activity that the user opens is arranged into a stack (back stack, to the rear stack, in accordance with the LIFO principle "first in the last Out").
When the current activity opens Another activity, the new Activiy is pressed into the top of the stack and gets the focus. The previous activity is still in the stack, but it is stopped. The system retains its current state of the user interface.
When the user presses the back button , the current activity pops up from the top of the stack (activity is destroyed destroyed) before the activity resumes (restores the previously saved user interface State).
The activity in the stack will never be rearranged. Only pushes and POPs from the stack
Press-in: The user opens from the current activity to another activity
Popup: The user presses the return key to leave the current activity.
Show the
the user opens Activity1, Activity2, Activity3, and then presses the back key to leave Activity3 return Activity2
The situation of the back stack.
1.Resumed (or running): Running status
Activity is on the screen foreground and has user focus.
2.Paused: Pause status
The other activity is in the foreground and has user focus. But the activity is still visible (visible).
Another activity on this activity, which is partially transparent or does not cover the entire screen.
The activity of a paused state is completely alive (the activity object is kept in memory, it retains all the state and member information, is still attached to the (attached to) window manager), but it is killed by the system in the case of extremely low storage space.
3.Stopped: Stop State
activity is completely obscured by other activity (now in the background).
A stopped activity is also alive (the activity object is kept in memory, it retains all the state and member information, but no attached to the window manager) is no longer visible to the user when there is When needed elsewhere, it may be killed at any time.
The following diagram is a good illustration of both the activity's running and pausing states.
Second activity is a running state, but it does not cover the entire screen, and the previous activity is a paused state.
Android Four Components--activity (i) Definition, status, and fallback stack