Start-up activities there is a startactivityforresult, this need to master.
Start the service and always use explicit intent.
The intent filter represents the type of intent that this component may want to accept. Also say, the intention has type?? What do you mean, if you do not specify intent filter, only the boot is displayed.
Create an intent:
Component name: In explicit, express start class, use Setcomponent,setclass,setclassname to set, so seen SetClass set,
If not added, it is implicit intent.
Action: Actions to be performed, such as Action_view action_send, can generally be initiated as a function or application, typically defined in <intent-filter>
Data: I saw it in the sunshine content provider,
Intent (Getapplicationcontext ()detailactivity. Class) . SetData (Itemuir); startactivity (Intent);
In Detailactivity's OnCreate: Getintent (). GetData () Gets the saved URI that is used to query the specific information.
@Overrideprotected voidonCreate(Bundle savedinstancestate) {Super. OnCreate (Savedinstancestate); Setcontentview (r.layout.Activity_detail);if(Savedinstancestate = =NULL) {Bundle arguments =NewBundle (); Arguments.putparcelable (detailfragment.Detail_uri, Getintent (). GetData ()); Detailfragment fragment =NewDetailfragment (); Fragment.setarguments (arguments); Getsupportfragmentmanager (). BeginTransaction (). Add (r.id.Weather_detail_container, Fragment). Commit (); }}
Category: Defined together with action in <intent-filter>, the combination appears.
Extras: It is also common to pass on additional information.
Flags: Useless or
The general definition, the most is this: or the simplest, even <intent-filter> are not, are relatively simple, but it is not easy to use it.
<activityAndroid: Name=". App. Isolatedservice$controller " Android: label="@string/activity_isolated_service_controller" Android: launchmode="Singletop" Android: enabled="@bool/atleastjellybean"><intent-filter><actionAndroid: Name="Android.intent.action.MAIN"/><categoryAndroid: Name="Android.intent.category.SAMPLE_CODE"/></intent-filter></activity>
Use implicit intent to note:
To ensure that there is a response, first test:
//Create The text message with a stringIntentsendintent= New Intent();sendintent.setaction(Intent.Action_send);sendintent.PutExtra(Intent.Extra_text,TextMessage);sendintent.SetType("Text/plain");//Verify that the intent would resolve to an activityif (sendintent.resolveactivity(Getpackagemanager()) != NULL) {startactivity(sendintent);}
Use Createchooser, display the title, let the user choose
Intentsendintent= New Intent(Intent.Action_send);...//Always use the string resources for UI text.//This says something like "Share this photo with"Stringtitle=getresources().getString(R.string.Chooser_title);//Create Intent to show the Chooser dialogIntentChooser= Intent.Createchooser(sendintent,title);//Verify The original intent would resolve to at least one activityif (sendintent.resolveactivity(Getpackagemanager()) != NULL) {startactivity(Chooser);}
Intent-filer, keep watching tomorrow.
Intent in-depth learning