1. Activity
(1) An activity is usually a separate screen (window), simply speaking, activity is an interactive interface, and a general application consists of one or more activity.
(2) Communication between activity through intent.
(3) Every activity in an Android app must be declared in the Androidmanifest.xml configuration file, or the activity will not be recognized or executed by the system.
(4) Life cycle of activity
The boot order of an activity:
OnCreate ()-->onstart ()-->onresume ()
When another activity starts:
First activity OnPause ()--second activity onCreate ()-->onstart ()-->onresume ()
--First activity onStop ()
When you return to the first activity:
Second activity OnPause ()--First activity Onrestart ()-->onstart ()-->onresume ()--second activity onStop ()-- OnDestroy ()
2.Activity status
Activity is generally considered to have the following four states:
Active: When an activity is at the top of the stack, it is visible, focused, and acceptable to user input. Android tries to keep it active as much as possible, killing other activities to ensure that the active activity has enough resources to use. When another activity is activated, this will be paused.
Pause: In many cases, your activity is visible but it has no focus, in other words it is paused. A possible reason is that a transparent or non-full-screen activity is activated.
When paused, an activity is still active, but it is not acceptable to user input. In very special cases, Android will kill a suspended activity to provide sufficient resources for active activity. When an activity becomes completely hidden, it will become a stop.
Stop: When an activity is not visible, it "stops". This activity will still save all its status and membership information in memory. However, when memory is needed elsewhere, it will be the most likely to be freed of resources. When an activity is stopped, an important step is to save the data and the current UI state. Once an activity exits or shuts down, it becomes a ready-to-use state.
To be used: After an activity is killed and put in front, it is ready to use. The pending acitivity is removed from the activity stack and needs to be restarted before it is displayed and available.
Recently, Love Beta (www.ineice.com) launched an activity component for mobile applications for security vulnerability detection
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Android four components of activity introduction