Although relatively simple, I 'd like to mention the main content.
Use of Intent
IntentYou can start an Activity., You can also start a service,You can also initiate a broadcast.
Activity startActivity (), startActivityForResult ();
Service startService (), bindService ()
BroadCast sendBroadcast (), sendOrderedBroadcast (), sendStickyBroadcast ();
IntentActionAttribute
Implicitly specified:
For example, declare in AActivity,
My_Action = "com. king. android. my_action ";
Intent intent = new Intent ();
Intent. setAction (My_Action );
Note:
BActiivty accept:
Intent intent = getAction ();
String action =-intent. getAction ();
AndroidMainFest. xml file
<Activity android: name = ". BActivity"
Android: label = "@ string/app_name">
<Intent-filter>
<Action android: name = "com. king. android. my_action"/> specify the conditions for consideration.
<Category android: name = "android. intent. category. LAUNCHER"/>
</Intent-filter>
</Activity>
Access System Action attributes,
Data Attribute of Intent
The Category attribute of Intent:
For example, CATEGORY_LAUNCHER, the application appears at the top, and CATEGORY_HOME returns to the home interface.
Although the Extras attribute of Intent is simple, it is important,
There are many standard system Activity actions. You can check them online.
Note the Intent Policy
1. Action
2. Category
3. Data