AndroidManifest. xml file description (intent-filter)

Source: Internet
Author: User

SYNTAX (SYNTAX ):

<Intent-filterandroid: icon = "drawable resource"
Android: label = "string resource"
Android: priority = "integer">
...
</Intent-filter>

Included IN (contained in ):

<Activity>

<Activity-alias>

<Service>

<Cycler>

Required elements (must contain ):

<Action>

Can contain ):

<Category>

<Data>

DESCRIPTION ):

This element is used to specify the type of Intent object that the Activity, Service, or Broadcast Receiver can respond. The Intent filter declares the capabilities of its parent component-what the Activity or Service can do and the Broadcast type that the Broadcast Receiver can process. It opens the component to receive Intent objects of the declared type and filters out Intent object requests that do not make sense to the component.

Most of the contents of the filter are described by <action>, <category>, and <data> sub-elements.

ATTRIBUTES (ATTRIBUTES ):

Android: icon

To display the capabilities of a filter to users, the component uses the icon set for this attribute to represent its parent component (Activity, Service, or Broadcast Receiver ER ).

This attribute must reference A plotting resource that contains the image definition. The default value is set by the icon attribute of the parent component. If no icon is specified for the parent component, the default value is the icon set by the <application> element.

Android: label

This attribute is used to set a user-readable label for its parent component. This label is not set by its parent component. This attribute value is used when the component displays the capabilities of the filter to the user.

This attribute value should reference a string resource so that it can be localized just like other strings in the user interface. However, you can also use native strings to facilitate application development.

The default value of this attribute is provided by its parent component. If no label is specified for the parent component, the default value is the TAG set by the <application> element.

Android: priority

This attribute is used to set a priority for the filter. Its Parent component can process Intent objects of the type described by the filter in sequence by priority. This attribute makes sense for Activity and Broadcast Referer objects:

1. It provides information about how the Activity can respond to Intent object requests that match the filter (compared with other activities that can also respond to this Intent request ). When an Intent object request can be processed by multiple activities with different priorities, the Android system only considers the high-priority Intent filter as the potential Intent Object Request target.

2. It controls the order in which the Broadcast Receiver receives Broadcast messages. Filters with a higher priority are called preferentially. (Only messages are applied and synchronized in this order. priority settings are ignored for asynchronous messages .)

This attribute is used only when you really want to apply a specific order to the filter that receives the broadcast message, or force Android to apply another Activity.

This attribute value must be an integer, for example, 100. The greater the number, the higher the priority.

INTRODUCED version (introduced in ):

API Level 1

 


From FireOfStar's column

Related Article

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.