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 orpathPrefix orpathPattern

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 portattribute 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,

<data android:scheme="something" android:host="" /> </intent-filter>

is equivalent to this one:

<intent-filter .

. >

<data android

scheme="something" />

<data android

host="" />


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 Filterssection in the introduction.

0 0

Post a comment