1.Intent is a bridge between component calls.
The 2.Android system defines a lot of intent
Http://developer.android.com/guide/components/intents-common.html
3.Intent
Intent includes content that can have one or more of the following
- Operation
- Data
- Extra data
- Component Name
The intent that contains the name of the component is called intent, otherwise it is called an implicit intent. Shows that intent ignores other parts of the component name when it does the target activity match.
New Intent (intent.action_dial)//Operation
Intent.setdata (uri.parse ("http://www.google.com")); Data
PutExtra (String name,...);//extra data
Intent.setcomponent (New ComponentName ("Com.android.contacts", "com.android.contacts.DialContactsEntryActivity"));//Component Name 4. The data is the result of parsing the URI, possibly an HTTP Web page, or ContentProvider ... This is determined by the data pattern, for example: Content:,file: And so on.
The received intent need to declare whether the data pattern can be handled by intent filters.
5. Pre-defined actions
Http://developer.android.com/guide/topics/manifest/data-element.html
6.extra data can provide more information to the target component. Extra data is represented by Android.os.Bundle, which is the form of a key-value pair, usually preceded by a package name, and the value is any object. The Android.os.Parcelable interface needs to be implemented.
The Putextra method is a copy operation.
7. Call the component directly using the component name. The package name and class name need to be fully qualified.
8. The category of the component.
Pre-defined Category
Http://developer.android.com/reference/android/content/Intent.html#CATEGORY_ALTERNATIVE
9.Intent includes 4 parts, if you do not specify a component name, it is implicit intent, for the use of implicit intent to start other components, the target component is determined by the remaining 3 part of the comprehensive effect to determine.
The application should write a intent filter in the declaration file for the Android system to determine whether the intent matches the app. Intent filter format if data (URI) is set when intent is set, the datatype should be set <intent-filter>
<action android:value= "Android.intent.action.MAIN"/>
<category android:value= "Android.intent.category.HOME"/>
<category android:value= "Android.intent.category.DEFAULT/>
....
The basic rules for </intent-filter> matching: action, type (category), data android:name and Andriod.mimetype must match the filter.
Specific rules:
Action: The filter does not contain theMatchAll operations, if included, must match.
Data: The filter does not specify a data featuredoes not matchAny intent calls that include data features must match if included.
DataType (data Android:mimetype): Must match. There are two ways to determine the data type
A. The incoming URI is the content or file Uri, which is determined by ContentProvider or Android
B. Show get Intent.gettype (). This needs to call Settype () when the client constructs the intent, and the call Settype should not set the URI because Settype is set automatically.
Data schema, data authorization, data path co-matching, that is, the longest match.
Intent Category: All the types in the call intent must be included in the intent filter. Call Intent if no category is included as the default category, the component that you want to invoke implicitly intent must declare the default category.
Android Learning five Intent