diff options
Diffstat (limited to 'docs/html/guide/topics')
-rw-r--r-- | docs/html/guide/topics/manifest/category-element.jd | 8 | ||||
-rw-r--r-- | docs/html/guide/topics/manifest/data-element.jd | 147 |
2 files changed, 85 insertions, 70 deletions
diff --git a/docs/html/guide/topics/manifest/category-element.jd b/docs/html/guide/topics/manifest/category-element.jd index 41a2cfd..a4b93ee 100644 --- a/docs/html/guide/topics/manifest/category-element.jd +++ b/docs/html/guide/topics/manifest/category-element.jd @@ -27,6 +27,14 @@ by prefixing "{@code android.intent.category.}" to the the string value for {@code CATEGORY_LAUNCHER} is "{@code android.intent.category.LAUNCHER}". +<p class="note"><strong>Note:</strong> In order to receive implicit intents, you must include the +{@link android.content.Intent#CATEGORY_DEFAULT} category in the intent filter. The methods +{@link android.app.Activity#startActivity startActivity()} and +{@link android.app.Activity#startActivityForResult startActivityForResult()} treat all intents +as if they declared the {@link android.content.Intent#CATEGORY_DEFAULT} category. +If you do not declare it in your intent filter, no implicit intents will resolve to +your activity.</p> + <p> Custom categories should use the package name as a prefix, to ensure that they are unique. diff --git a/docs/html/guide/topics/manifest/data-element.jd b/docs/html/guide/topics/manifest/data-element.jd index 766d2d7..27950d0 100644 --- a/docs/html/guide/topics/manifest/data-element.jd +++ b/docs/html/guide/topics/manifest/data-element.jd @@ -5,34 +5,35 @@ parent.link=manifest-intro.html <dl class="xml"> <dt>syntax:</dt> -<dd><pre class="stx"><data android:<a href="#host">host</a>="<i>string</i>" - android:<a href="#mime">mimeType</a>="<i>string</i>" +<dd><pre class="stx"><data android:<a href="#scheme">scheme</a>="<i>string</i>" + android:<a href="#host">host</a>="<i>string</i>" + android:<a href="#port">port</a>="<i>string</i>" android:<a href="#path">path</a>="<i>string</i>" android:<a href="#path">pathPattern</a>="<i>string</i>" android:<a href="#path">pathPrefix</a>="<i>string</i>" - android:<a href="#port">port</a>="<i>string</i>" - android:<a href="#scheme">scheme</a>="<i>string</i>" /></pre></dd> + android:<a href="#mime">mimeType</a>="<i>string</i>" /></pre></dd> <dt>contained in:</dt> <dd><code><a href="{@docRoot}guide/topics/manifest/intent-filter-element.html"><intent-filter></a></code></dd> <dt>description:</dt> -<dd>Adds a data specification to an intent filter. The specification can -be just a data type (the <code><a href="{@docRoot}guide/topics/manifest/data-element.html#mime">mimeType</a></code> attribute), -just a URI, or both a data type and a URI. A URI is specified by separate +<dd>Adds a data specification to an intent filter. The specification can +be just a data type (the <code><a href="{@docRoot}guide/topics/manifest/data-element.html#mime">mimeType</a></code> attribute), +just a URI, or both a data type and a URI. A URI is specified by separate attributes for each of its parts: -<p style="margin-left: 2em">{@code scheme://host:port/path} <i>or</i> -{@code pathPrefix} <i>or</i> {@code pathPattern}</p> +<p style="margin-left: 2em"> +{@code <scheme>://<host>:<port>/[<path>|<pathPrefix>|<pathPattern>]}</p> <p> -These attributes are optional, but also mutually dependent: -If a <code><a href="{@docRoot}guide/topics/manifest/data-element.html#scheme">scheme</a></code> is not specified for the -intent filter, all the other URI attributes are ignored. If a -<code><a href="{@docRoot}guide/topics/manifest/data-element.html#host">host</a></code> is not specified for the filter, -the {@code port} attribute and all the path attributes are ignored. -</p> +These attributes that specify the URL format are optional, but also mutually dependent: +<ul> + <li>If a <code><a href="{@docRoot}guide/topics/manifest/data-element.html#scheme">scheme</a></code> +is not specified for the intent filter, all the other URI attributes are ignored.</li> + <li>If a <code><a href="{@docRoot}guide/topics/manifest/data-element.html#host">host</a></code> +is not specified for the filter, the {@code port} attribute and all the path attributes are ignored. +</ul> <p> All the {@code <data>} elements contained within the same @@ -54,111 +55,117 @@ the same filter. So, for example, the following filter specification, </intent-filter></pre> <p> -You can place any number of <data> elements inside an -<code><a href="{@docRoot}guide/topics/manifest/intent-filter-element.html"><intent-filter></a></code> to give it multiple data -options. None of its attributes have default values. +You can place any number of {@code <data>} elements inside an +<code><a href="{@docRoot}guide/topics/manifest/intent-filter-element.html"><intent-filter></a></code> to give it multiple data +options. None of its attributes have default values. </p> <p> Information on how intent filters work, including the rules for how Intent objects are matched against filters, can be found in another document, <a href="{@docRoot}guide/components/intents-filters.html">Intents and -Intent Filters</a>. See also the -<a href="{@docRoot}guide/topics/manifest/manifest-intro.html#ifs">Intent Filters</a> -section in the introduction. +Intent Filters</a>. See also the +<a href="{@docRoot}guide/topics/manifest/manifest-intro.html#ifs">Intent Filters</a> +section in the manifest file overview. </p></dd> <dt>attributes:</dt> <dd><dl class="attr"> + +<dt><a name="scheme"></a>{@code android:scheme}</dt> +<dd>The scheme part of a URI. This is the minimal essential attribute for +specifying a URI; at least one {@code scheme} attribute must be set +for the filter, or none of the other URI attributes are meaningful. + +<p> +A scheme is specified without the trailing colon (for example, +{@code http}, rather than {@code http:}). +</p> + +<p> +If the filter has a data type set (the <code><a +href="{@docRoot}guide/topics/manifest/data-element.html#mime">mimeType</a></code> +attribute) but no scheme, the {@code content:} and {@code file:} schemes are +assumed. +</p> + +<p class="note"><strong>Note</strong>: Scheme matching in the Android framework is +case-sensitive, unlike the RFC. As a result, you should always specify schemes +using lowercase letters.</p> +</dd> + <dt><a name="host"></a>{@code android:host}</dt> <dd>The host part of a URI authority. This attribute is meaningless -unless a <code><a href="{@docRoot}guide/topics/manifest/data-element.html#scheme">scheme</a></code> attribute is also +unless a <code><a href="{@docRoot}guide/topics/manifest/data-element.html#scheme">scheme</a></code> attribute is also specified for the filter. -<p class="note">Note: host name matching in the Android framework is +<p class="note"><strong>Note</strong>: 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.</p> </dd> -<dt><a name="mime"></a>{@code android:mimeType}</dt> -<dd>A MIME media type, such as {@code image/jpeg} or {@code audio/mpeg4-generic}. -The subtype can be the asterisk wildcard ({@code *}) to indicate that any -subtype matches. -<p>It's common for an intent filter to declare a {@code <data>} that includes -only the {@code android:mimeType} attribute.</p> +<dt><a name="port"></a>{@code android:port}</dt> +<dd>The port part of a URI authority. This attribute is meaningful only +if the <code><a href="#scheme">scheme</a></code> and +<code><a href="#host">host</a></code> attributes are also specified for +the filter.</dd> -<p class="note">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.</p> -</dd> <dt><a name="path"></a>{@code android:path} <br/>{@code android:pathPrefix} <br/>{@code android:pathPattern}</dt> -<dd>The path part of a URI. The {@code path} attribute specifies a complete -path that is matched against the complete path in an Intent object. The -{@code pathPrefix} attribute specifies a partial path that is matched against -only the initial part of the path in the Intent object. The {@code pathPattern} -attribute specifies a complete path that is matched against the complete path -in the Intent object, but it can contain the following wildcards: +<dd>The path part of a URI. The {@code path} attribute specifies a complete +path that is matched against the complete path in an Intent object. The +{@code pathPrefix} attribute specifies a partial path that is matched against +only the initial part of the path in the Intent object. The {@code pathPattern} +attribute specifies a complete path that is matched against the complete path +in the Intent object, but it can contain the following wildcards: <ul> <li>An asterisk ('{@code *}') matches a sequence of 0 to many occurrences of the immediately preceding character.</li> -<li>A period followed by an asterisk ("{@code .*}") matches any sequence of +<li>A period followed by an asterisk ("{@code .*}") matches any sequence of 0 to many characters.</li> </ul> <p> -Because '{@code \}' 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 '{@code *}' would be written as "{@code \\*}" and a -literal '{@code \}' would be written as "{@code \\\\}". This is basically +Because '{@code \}' 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 '{@code *}' would be written as "{@code \\*}" and a +literal '{@code \}' would be written as "{@code \\\\}". This is basically the same as what you would need to write if constructing the string in Java code. </p> <p> -For more information on these three types of patterns, see the descriptions of +For more information on these three types of patterns, see the descriptions of {@link android.os.PatternMatcher#PATTERN_LITERAL}, {@link android.os.PatternMatcher#PATTERN_PREFIX}, and {@link android.os.PatternMatcher#PATTERN_SIMPLE_GLOB} in the {@link android.os.PatternMatcher} class. </p> -<p>These attributes are meaningful only if the -<code><a href="#scheme">scheme</a></code> and <code><a href="#host">host</a></code> +<p>These attributes are meaningful only if the +<code><a href="#scheme">scheme</a></code> and <code><a href="#host">host</a></code> attributes are also specified for the filter. </p></dd> -<dt><a name="port"></a>{@code android:port}</dt> -<dd>The port part of a URI authority. This attribute is meaningful only -if the <code><a href="#scheme">scheme</a></code> and -<code><a href="#host">host</a></code> attributes are also specified for -the filter.</dd> - -<dt><a name="scheme"></a>{@code android:scheme}</dt> -<dd>The scheme part of a URI. This is the minimal essential attribute for -specifying a URI; at least one {@code scheme} attribute must be set -for the filter, or none of the other URI attributes are meaningful. +<dt><a name="mime"></a>{@code android:mimeType}</dt> +<dd>A MIME media type, such as {@code image/jpeg} or {@code audio/mpeg4-generic}. +The subtype can be the asterisk wildcard ({@code *}) to indicate that any +subtype matches. -<p> -A scheme is specified without the trailing colon (for example, -{@code http}, rather than {@code http:}). -</p> +<p>It's common for an intent filter to declare a {@code <data>} that includes +only the {@code android:mimeType} attribute.</p> -<p> -If the filter has a data type set (the <code><a href="{@docRoot}guide/topics/manifest/data-element.html#mime">mimeType</a></code> -attribute) but no scheme, the {@code content:} and {@code file:} schemes are -assumed. -</p> -<p class="note">Note: scheme matching in the Android framework is -case-sensitive, unlike the RFC. As a result, you should always specify schemes -using lowercase letters.</p> +<p class="note"><strong>Note</strong>: 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.</p> </dd> -</dl></dd> + +</dl></dd> <!-- ##api level indication## --> <dt>introduced in:</dt> |