<data>

syntax:
<data android:host="string"
      android:mimeType="string"
      android:path="string"
      android:pathPattern="string"
      android:pathPrefix="string"
      android:port="string"
      android:scheme="string" />
contained in:
<intent-filter>
description:
Adds a data specification to an intent filter. The specification can be just a data type (the mimeType attribute), just a URI, or both a data type and a URI. A URI is specified by separate attributes for each of its parts:

scheme://host:port/path or pathPrefix or pathPattern

These attributes are optional, but also mutually dependent: If a scheme is not specified for the intent filter, all the other URI attributes are ignored. If a host is not specified for the filer, the port attribute and all the path attributes are ignored.

All the <data> elements contained within the same <intent-filter> element contribute to the same filter. So, for example, the following filter specification,

<intent-filter . . . >
    <data android:scheme="something" android:host="project.example.com" />
    . . .
</intent-filter>

is equivalent to this one:

<intent-filter . . . >
    <data android:scheme="something" /&gt
    <data android:host="project.example.com" />
    . . .
</intent-filter>

You can place any number of <data> elements inside an <intent-filter> to give it multiple data options. None of its attributes have default values.

Information on how intent filters work, including the rules for how Intent objects are matched against filters, can be found in another document, Intents and Intent Filters. See also the Intent Filters section in the introduction.

인텐트 필터에 데이터 명세를 추가한다. 그 명세는 데이터 타입(mimeType 애트리뷰트)만으로 될 수도 있고, URI만일 수도 있고, 또는 데이터 타입과 URI 둘 다일 수도 있다. URI는 그것의 각각의 부분들에 대한 별도의 애트리뷰트들에 의해 지정된다.

scheme://host:port/path or pathPrefix or pathPattern

이 애트리뷰트들은 선택 사항이지만, 또한 상호 간에 의존적이다: 만약 인텐트 필터에 대한 스키마scheme가 지정되지 않는다면, 다른 모든 URI 애트리뷰트들은 무시된다. 만약 인텐트 필터에 대한 호스트host가 지정되지 않는다면, 포트port 애트리뷰트와 모든 경로path 애트리뷰트는 무시된다.

동일 <intent-filter> 엘리먼트 내에 포함된 모든 <data> 엘리먼트는 동일 필터에 기여한다. 예를 들면 다음의 필터 명세는,

<intent-filter . . . >
    <data android:scheme="something" android:host="project.example.com" />
    . . .
</intent-filter>

아래의 것과 동일하다.

<intent-filter . . . >
    <data android:scheme="something" /&gt
    <data android:host="project.example.com" />
    . . .
</intent-filter>

여러분은 인텐트 필터에 다양한 데이터 옵션을 주기 위하여 <intent-filter> 안에 임의의 갯수의 <data> 엘리먼트를 놓을 수 있다. 그것의 애트리뷰트들 중 어떤 것도 디폴트 값을 가지지 않는다.

인텐트 오브젝트가 필터와 일치되는 방법에 대한 규칙을 포함하는 인텐트 필터의 동작방법에 대한 정보는 다른 문서, 인텐트와 인텐트 필터에서 찾을 수 있다. 앞에 나왔던 인텐트 필터 섹션을 또한 보라.

attributes:
android:host
The host part of a URI authority. This attribute is meaningless unless a scheme attribute is also specified for the filter.

Note: host name matching in the Android framework is case-sensitive, unlike the formal RFC. As a result, you should always specify host names using lowercase letters.

URI 권위authority의 호스트host 영역. 필터에 대한 스키마scheme 애트리뷰트가 또한 지정되지 않는 한, 이 애트리뷰트는 의미가 없다.

Note: 공식 RFC와는 달리, 안드로이드 프레임워크에서의 호스트 이름 매칭은 대소문자를 구분한다. 결과적으로 여러분은 항상 호스트 이름을 소문자로 지정해야 한다.

android:mimeType
A MIME media type, such as image/jpeg or audio/mpeg4-generic. The subtype can be the asterisk wildcard (*) to indicate that any subtype matches.

Note: MIME type matching in the Android framework is case-sensitive, unlike formal RFC MIME types. As a result, you should always specify MIME types using lowercase letters.

image/jpeg 또는 audio/mpeg4-generic과 같은 MIME 미디어 타입. 서브타입은 어떤 서브타입과도 일치된다는 것을 가리키기 위해 별표 와일드카드(*)가 될 수 있다.

Note: 공식 RFC MIME 타입과는 달리, 안드로이드 프레임워크에서 MIME 타입 매칭은 대소문자를 구분한다. 결과적으로 여러분은 항상 MIME 타입을 소문자를 사용해서 지정해야 한다.

android:path
android:pathPrefix
android:pathPattern
The path part of a URI. The path attribute specifies a complete path that is matched against the complete path in an Intent object. The pathPrefix attribute specifies a partial path that is matched against only the initial part of the path in the Intent object. The pathPattern attribute specifies a complete path that is matched against the complete path in the Intent object, but it can contain the following wildcards:
  • An asterisk ('*') matches a sequence of 0 to many occurrences of the immediately preceding character.
  • A period followed by an asterisk (".*") matches any sequence of 0 to many characters.

Because '\' is used as an escape character when the string is read from XML (before it is parsed as a pattern), you will need to double-escape: For example, a literal '*' would be written as "\\*" and a literal '\' would be written as "\\\\". This is basically the same as what you would need to write if constructing the string in Java code.

For more information on these three types of patterns, see the descriptions of PATTERN_LITERAL, PATTERN_PREFIX, and PATTERN_SIMPLE_GLOB in the PatternMatcher class.

These attributes are meaningful only if the scheme and host attributes are also specified for the filter.

URI의 path(경로) 영역. path 애트리뷰트는 인텐트 오브젝트 내의 전체 경로path와 일치하는 전체 경로path를 지정한다. pathPrefix 애트리뷰트는 인텐트 오브젝트 내 경로path의 첫 머리만 일치하는 부분적인 경로path를 지정한다. pathPattern 애트리뷰트는 인텐트 오브젝트 내의 전체 경로path에 일치하는 전체 경로path를 지정하지만, 그것은 다음과 같은 와일드카드를 포함할 수 있다.
  • 별표(‘*’)는 바로 앞에 나오는 문자가 0번 이상 발생하는 것을 나타낸다.
  • 마침표 뒤에 별표가 나오는 것(“.*”)은 어떤 문자든 0번 이상 발생하는 것을 나타낸다.

문자열이 XML로부터 읽어질 때(그것이 패턴으로써 분석되기 전에) “\”는 이스케이프escape 문자로써 사용되기 때문에, 여러분은 두 개의 이스케이프escape가 필요할 것이다.: 예를 들어 글자 그대로인 ‘*’는 “\\*”로 작성되어질 것이고, 글자 그대로인 ‘\’는 “\\\\”로 작성되어질 것이다. 이것은 여러분이 만약 Java 코드 안에서 문자열을 만들 때 작성할 필요가 있는 것과 기본적으로 같다.

이러한 세 가지 타입의 패턴에 대한 더 많은 정보에 대해서는, PatternMatcher 클래스 안의 PATTERN_LITERAL, PATTERN_PREFIX, 그리고 PATTERN_SIMPLE_GLOB에 대한 설명을 보라.

스키마scheme와 호스트host 애트리뷰트가 필터에 대해서 지정되기만 하면 이 애트리뷰트들은 의미를 갖는다.

android:port
The port part of a URI authority. This attribute is meaningful only if the scheme and host attributes are also specified for the filter.
URI 권위authority의 port 영역. 이 애트리뷰트는 필터에 대해 스키마scheme와 호스트host 애트리뷰트가 또한 지정될 때에만 의미를 갖는다.
android:scheme
The scheme part of a URI. This is the minimal essential attribute for specifying a URI; at least one scheme attribute must be set for the filter, or none of the other URI attributes are meaningful.

A scheme is specified without the trailing colon (for example, http, rather than http:).

If the filter has a data type set (the mimeType attribute) but no scheme, the content: and file: schemes are assumed.

Note: scheme matching in the Android framework is case-sensitive, unlike the RFC. As a result, you should always specify schemes using lowercase letters.

URI의 scheme영역. 이것은 URI를 지정하기 위한 최소한의 필수 애트리뷰트이다; 적어도 필터를 위해선 하나의 scheme 애트리뷰트는 설정되어야 하며, 그렇지 않다면 URI의 나머지 애트리뷰트들은 의미가 없다.

스키마scheme는 뒤에 콜론 없이 지정된다(예를 들어 http: 이라기보다는 http이다).

만약 필터가 어떤 스키마scheme도 없이 데이터 타입 설정(mimeType 애트리뷰트)을 가진다면, content: 과 file: 스키마scheme로 가정된다.

Note: RFC와는 달리, 안드로이드 프레임워크에서 스키마 매칭은 대소문자를 구분한다. 결과적으로 여러분은 항상 스키마를 소문자를 사용해서 지정해야 한다.

introduced in:
API Level 1
see also:
<action>
<category>
↑ Go to top