I e-mail: [email protected], welcome to exchange discussions.
Welcome reprint, Reprint please specify the website: http://www.cnblogs.com/JohnTsai/p/3991792.html
- Knowledge points: the definition and function of Intents and Intent filters and their usage.
- Intent
Intent this word means "intent", as it means, in Android it is an expression of the intention to implement a function (intention to does an action).
definition :
Intent is the object that transmits messages (messaging object), which transmits messages that require certain features of other application components. The scope of the intent can be
Within the same Android app, it can also be a different application. For example, the sweep function we use often turns on the activity of the system taking photos.
Intent is an object of type android.content.Intent that can carry data through bundles.
Use :
1. Activate activity (start an activity)
1 // Start Method: 2 3 startactivity (Intent Intent)45 startactivityforresult (Intent Intent)
2. Start Service (start a service)
1 // Start Method: 2 3 StartService (Intent service)4 int flags)
3. Release broadcast (deliver a broadcast)
// Start Method sendbroadcast (Intent Intent) sendbroadcast (Intent Intent, String receiverpermission) Sendorderedbroadcast (Intent Intent, string receiverpermission) int Initialcode, string Initialdata, Bundle Initialextras) sendstickybroadcast (Intent Intent) int Initialcode, String Initialdata, Bundle Initialextras)
type
There are two types of intent: Display Intent (Explicit intents ) and implicit intent (implicit intents)
Display intent specifies that the component is started by name (the fully qualified class name, the Fully-qualified class name). We typically use explicit intent to launch components in our own apps because we know the class name of the activity or service in our app.
As an example:
As feedback on user actions, open a new activity or open a background download file service.
Implicit intent does not require the class name of the specific component, instead it declares a generic function of the intent, which the other application's components will handle.
To be continued .....
Android Learning notes--intents and Intent Filters (i)