Android Development-api Guide-<data>

Source: Internet
Author: User
Tags rfc

<data>

English Original: http://developer.android.com/guide/topics/manifest/data-element.html
Acquisition (update) Date: 2014-6-30
Moved from the original blog: http://blog.sina.com.cn/s/blog_48d491300101h236.html

Grammar:
<android:scheme= "string"      android:host= "string"       Android:port = "string"       android:path= "string"      android:pathpattern= "string"       Android:pathprefix = "string"       android:mimetype= "string"/>
Included in:
<intent-filter>
Description
The definition of a data item is added to the Intent filter. This definition can have only data types ( mimeTypeproperty), only URIs, or both data types and URIs. URIs are composed of multiple independent attributes, as follows:

<scheme> ://

These properties that define the URL format are optional, but also have interdependencies:

    • If the Intent filter is not defined scheme , all other URI properties are ignored.
    • If the Intent filter is not definedhost,则 port 属性和所有路径属性都将被忽略。

<intent-filter> all elements contained within the same element <data> are used for the same filter. For example, the following filters are defined:

<>    <android:scheme= "Something"  android:host= "project.example.com"/>    ... </ Intent-filter >

is equivalent to the following definition:

<>    <android:scheme= "Something"  />    <android:host= "project.example.com" />     . . . </ Intent-filter >

<intent-filter> you can place any number of elements within one to <data> give more than one data item. All properties do not have a default value.

About the working mechanism of the Intent filter, including the Intent object and filter matching rules, you can check another document Intent and Intent filter. See the Intent Filter section in the Manifest overview.

Property:
android:scheme
the scheme part of the URI. This is a property that defines a URI that must have at least one, otherwise the other URI properties are meaningless.

Scheme do not end with a colon (for example http , instead http: ).

If the filter defines a data type ( mimeType attribute) but does not define scheme, the system assumes content: the use and file: type of scheme.

Note: Unlike RFC, the scheme type that meets the requirements of the Android platform is case-sensitive. Therefore, be sure to use lowercase letters to specify the scheme type.

android:host
The host name portion of the URI. This property is meaningful only if the filter is also assigned a scheme property.

Note: Unlike the usual RFC, host names that meet the requirements of the Android platform are case-sensitive. Therefore, be sure to specify host in lowercase letters.

android:port
the port portion of the URI. This property makes sense only if both the filter and the attribute are specified at the same time scheme host .
android:path
android:pathPrefix
android:pathPattern
The path portion of the URI. The path Intent property defines the full path of the matching object. The pathPrefix Intent property defines the starting part of the path to the matching object. The pathPattern Intent property defines the full path of the matching object, except that it can contain the following wildcard characters:
  • Matches 0 or more occurrences of the character immediately preceding it with an asterisk ("*").
  • A period followed by an asterisk (". *") matches any character 0 or more times.

When reading a string from XML (before parsing as an expression), "\" is used as an escape character and therefore requires two escapes: for example, "" * should be written "," " \\* \ should be written" " \\\\ . This is basically the same as the syntax for constructing strings in Java code.

For more information about these three expressions, see the PatternMatcher PATTERN_LITERAL , and descriptions in the class PATTERN_PREFIX PATTERN_SIMPLE_GLOB .

schemeThese properties are meaningful only if the filters and host properties are defined.

android:mimeType
MIME multimedia type, such as image/jpeg or audio/mpeg4-generic . The subtype can be a wildcard asterisk number ( * ), which means that any subtype can be matched.

Intent filters often declare a property that contains only android:mimeType attributes <data> .

Note : Note: Unlike the usual RFC MIME types, MIME types that meet the requirements of the Android platform are case-sensitive. Therefore, be sure to specify the MIME type in lowercase letters.

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

Android Development-api Guide-<data>

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.