Android Learning notes--intents and Intent Filters (i)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.