Intent Chinese Meaning: intention
Intent is a bridge between the components and is very important in Android.
Inten can be launched in roughly three categories: Activity (interface), Service (services), broadcasts (broadcast)
Start interface: StartActivity (), Startactivityforresult ();
Start-Up service: StartService (), Bindservice ()
Send broadcast: Sendbroadcasts ()
The intent is divided into explicit intention and implicit intention two kinds of
Explicit intent: Need to explicitly indicate which components are open
Implicit intent: An open component is not explicitly indicated
The attributes of the intent are:
Display: Component
Hermit intent: Action,category,data, type, extras,flags
Intent mainly has the following four important attributes, respectively:
Action:The value of the Action property is a string that represents a series of commonly used actions that have been defined in the system. Set through the Setaction () method or in the manifest file androidmanifest.xml. Defaults to: Default.
Data:data is usually the operation data defined by the URI format. For example: tel://. Set by the SetData () method.
Category: The Category property specifies the environment in which the current action (action) is executed 。 Set through the Addcategory () method or in the manifest file androidmanifest.xml. The default is: category_default.
Extras:extras property is primarily used to deliver the additional data required by the target component
Action: Actions-----------Intent the type of action to complete----required: string
The sample code is as follows: Intent Intent = new Intent (); Intent.setaction ("com.cpc.www"); StartActivity (Intent);
Category: Additional information for action actions
use filters to specify the type of Intentfilter received
The intent request passes the test only if all of the category in the intent request exactly matches the <category> of one of the intentfilter in the component, and the extra <category in Intentfilter The > declaration does not result in a match failure.
Flags
1) Standard: default mode, when the current interface is started, a new stack is created, the activity is managed, the new activity instance is added to the stack
2) Singletop: Stack Top Single Instance
A. If the target interface is in the stack, create a new Activity object
B. If the target interface is at the top of the stack, no new activity objects will be created
3) Singletask: Single Instance in stack
A. If the target interface does not exist in the stack, create a new Activity object
B. If the target interface already exists in the stack, clear the previous acticity in the stack and place the target interface on top of the stack
4) SingleInstance: Global Single Instance
Note: Set up an activity singleinstance, at which point, if you need to load the activity, another stack is created to manage the activity
A. If Acticity is not stored in the stack, create a new Activity object
B. If activity already exists in the stack, move the existing acticity to the top of the stack
Flags
Intent.flag_activity_new_task similar to standard
Intent.flag_activity_clear_top similar to Singletask
Intent.flag_activity_single_top similar to Singletop
Incomplete summary, see a summary of very good, here is not summed up
http://blog.csdn.net/weihan1314/article/details/7973511
Intent of Android Learning notes