Android Development-api Guide-<intent-filter>

Source: Internet
Author: User

<intent-filter>

English Original: http://developer.android.com/guide/topics/manifest/intent-filter-element.html
Acquisition (update) Date: 2014-7-1
Moved from the original blog: http://blog.sina.com.cn/s/blog_48d491300100zmuk.html

Grammar:
<intent-filter android:icon="drawable resource"               android:label="  string resource"               android:priority="integer" >     ... </intent-filter>

Included in:
<activity>
<activity-alias>
<service>
<receiver>
Must contain:
<action>
can include:
<category>
<data>
Description
defines the type of Intent that can be responded to by Activity, Service, or broadcast Receiver. The Intent filter declares the functionality of its parent component-activity or the functionality that the Service can accomplish and the type of broadcast that Receiver can handle. This filters out Intent that do not make sense to the component and opens the appropriate component to receive Intent of the specified type.

Most of the content of the filter is declared by its <action> , <category> and <data> child elements.

For a more detailed discussion of filters, see the separate document Intent and Intent filters, as well as the Intent filter section in the Manifest introduction.

Property:
android:icon
An icon for the user to view the Activity, Service, or broadcast Receiver, indicating that these components have the functionality described by the filter.

This property must be set to a reference to the drawable resource that contains the definition of the picture. The default value is the property of the owning parent component icon . If the parent component does not specify an icon, the default value is <application> the icon for the element setting.

For more information about the Intent filter icon, see the icons and Text Labels section of the Manifest introduction article.

android:label
The
text label for the parent component to which the user is viewing. Unlike the text labels defined by the parent component, this label is used to indicate to the user that the parent component has the functionality described by the filter.

The text label should be set as a reference to the string resource so that it can be localized like any other string in the user interface. However, for the convenience of application development, it can also be set directly to a string.

The default value is the text label set by the parent component. If the parent component does not have a text label set, the default value is the <application> attribute set by the element label .

For more information about Intent filter text labels, see the Icons and Text Labels section of the Manifest introduction article.

android:priority
To handle the Intent of a filter-specified type, the parent component is given a priority. This property applies to both Activity and broadcast Receiver:
  • It gives priority to how the activity responds to Intent that match the filter, which is relative to other activity that also responds to such Intent. When a Intent can be responded to by several different priority activity, Android will only consider the higher priority activity as the Intent potential delivery target.
  • It controls the order in which each broadcast receiver receives broadcast messages. A higher priority Receiver will be called with a priority lower than the priority level. (This applies only to synchronous messages, which are ignored by asynchronous messages).

This property is used only if you do need to forcibly specify the order in which the broadcast message is received, or if you need to force Android to prioritize an Activity.

This property must be an integer value, such as " 100 ". The larger the number, the higher the priority. The default value is 0. The value of this property must be between 1000 and 1000.

Please refer to setPriority() .

Introduced from:
API Level 1
See:
<action>
<category>
<data>

Android Development-api Guide-<intent-filter>

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.