Introduction to Intent Properties

Source: Internet
Author: User

There are four components in the design of the Android system: Activity,service,broadcastreceiver,contentprovider. Intent can be used to interconnect, share, and interact data (even across process limits) among the other three components outside of ContentProvider, largely solving the coupling between components and making components more independent. So some people put intent as the fifth largest component. Literally speaking, intent is the meaning of "intention, intention", which serves other components, so its own design has great versatility. This article focuses on the properties behind these powerful features

1.ComponentName

Intent is mainly divided into two categories: dominant (Explicit Intent) and recessive (implicit Intent). ComponentName is mainly used in the dominant intent, which defines the name of the component that needs to be enabled (if it is the other component within the same program, only the specific componentname, if you need to add PackageName in different applications), The system will then send the intent to the corresponding component;

2.Category

Category is a kind of meaning, it will intent from the large range of classification, compared to the specific componentname more wide. Some ranges or functions have been preset in the Android system. Of course, the same can be customized. The following table shows some of the more commonly used property descriptions:

Category name Describe
Category_default The default category value. Category is required when starting a component using an implicit intent method. If you do not specify that the system will default to Category_default when you start the component, you must add Category_default in the intent filter where the component is registered to use
Category_home Indicates that the application is the first application launched after the operating system starts. It is usually used by launcher.
Category_launcher This property value indicates that the component can be placed in the startup list (Launcher) to start (typically an application entry)

          

                

  

3.Action

Action is the meaning of action, indicating what to do. The Android system also defines a number of actions that enable you to start some system-level components (functions) to do something. The same action can be customized to enable the components we enable. The following table shows the more commonly used action for a system

Action Name Describe
Action_main Indicates that a new task is initiated by this component and is generally used for the use of the portal activity
Action_call Enable an activity to make a call
Action_answer Components to process incoming calls

4.Data

Data means that you need intent to carry data that can be taken from the source component to the target component for use by the target component. It typically uses a scheme://uri-like expression, which also refers to the MIME type of the data

5.Extras

Extras is a supplement to the data above, and unlike data, it uses Key-value to preserve the data. Inside it is the ability to cross a bundle object to ensure the accuracy and integrity of the data

6.Flags

Flags are mainly used in the activation of activity components, and their main functions are related to the launchermode of activity. It specifies how the system enables an activity component and the task to which the activity belongs

The above-mentioned definitions guarantee the core function of intent and its indispensable position: to activate the component filter (componentname,category,action); Extras) and the more specific activation mode associated with the activity component (Flags)

Description of the properties of intent

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.