1 page.title=<intent-filter> 2 @jd:body 3 4 <dl class="xml"> 5 <dt>syntax:</dt> 6 <dd><pre class="stx"><intent-filter android:<a href="#icon">icon</a>="<i>drawable resource</i>" 7 android:<a href="#label">label</a>="<i>string resource</i>" 8 android:<a href="#priority">priority</a>="<i>integer</i>" > 9 . . . 10 </intent-filter></pre></dd> 11 12 <dt>contained in:</dt> 13 <dd><code><a href="{@docRoot}guide/topics/manifest/activity-element.html"><activity></a></code> 14 <br/><code><a href="{@docRoot}guide/topics/manifest/activity-alias-element.html"><activity-alias></a></code> 15 <br/><code><a href="{@docRoot}guide/topics/manifest/service-element.html"><service></a></code> 16 <br/><code><a href="{@docRoot}guide/topics/manifest/receiver-element.html"><receiver></a></code></dd> 17 18 <dt>must contain:</dt> 19 <dd><code><a href="{@docRoot}guide/topics/manifest/action-element.html"><action></a></code></dd> 20 21 <dt>can contain:</dt> 22 <dd><code><a href="{@docRoot}guide/topics/manifest/category-element.html"><category></a></code> 23 <br/><code><a href="{@docRoot}guide/topics/manifest/data-element.html"><data></a></code></dd> 24 25 <dt>description:</dt> 26 <dd>Specifies the types of intents that an activity, service, or broadcast 27 receiver can respond to. An intent filter declares the capabilities of its 28 parent component — what an activity or service can do and what types 29 of broadcasts a receiver can handle. It opens the component to receiving 30 intents of the advertised type, while filtering out those that are not 31 meaningful for the component. 32 33 <p> 34 Most of the contents of the filter are described by its 35 <code><a href="{@docRoot}guide/topics/manifest/action-element.html"><action></a></code>, 36 <code><a href="{@docRoot}guide/topics/manifest/category-element.html"><category></a></code>, and 37 <code><a href="{@docRoot}guide/topics/manifest/data-element.html"><data></a></code> subelements. 38 </p> 39 40 <p> 41 For a more detailed discussion of filters, see the separate 42 <a href="{@docRoot}guide/topics/intents/intents-filters.html">Intents 43 and Intent Filters</a> document, as well as the 44 <a href="{@docRoot}guide/topics/manifest/manifest-intro.html#ifs">Intents Filters</a> 45 section in the introduction. 46 </p></dd> 47 48 <dt>attributes:</dt> 49 <dd><dl class="attr"> 50 <dt><a name="icon"></a>{@code android:icon}</dt> 51 <dd>An icon that represents the parent activity, service, or broadcast 52 receiver when that component is presented to the user as having the 53 capability described by the filter. 54 55 <p> 56 This attribute must be set as a reference to a drawable resource 57 containing the image definition. The default value is the icon set 58 by the parent component's {@code icon} attribute. If the parent 59 does not specify an icon, the default is the icon set by the 60 <code><a href="{@docRoot}guide/topics/manifest/application-element.html"><application></a></code> element. 61 </p> 62 63 <p> 64 For more on intent filter icons, see 65 <a href="{@docRoot}guide/topics/manifest/manifest-intro.html#iconlabel">Icons and Labels</a> 66 in the introduction. 67 </p></dd> 68 69 <dt><a name="label"></a>{@code android:label}</dt> 70 <dd>A user-readable label for the parent component. This label, rather than 71 the one set by the parent component, is used when the component is presented 72 to the user as having the capability described by the filter. 73 74 <p> 75 The label should be set as a reference to a string resource, so that 76 it can be localized like other strings in the user interface. 77 However, as a convenience while you're developing the application, 78 it can also be set as a raw string. 79 </p> 80 81 <p> 82 The default value is the label set by the parent component. If the 83 parent does not specify a label, the default is the label set by the 84 <code><a href="{@docRoot}guide/topics/manifest/application-element.html"><application></a></code> element's 85 <code><a href="{@docRoot}guide/topics/manifest/application-element.html#label"> label</a></code> attribute. 86 </p> 87 88 <p> 89 For more on intent filter labels, see 90 <a href="{@docRoot}guide/topics/manifest/manifest-intro.html#iconlabel">Icons and Labels</a> 91 in the introduction. 92 </p></dd> 93 94 <dt><a name="priority"></a>{@code android:priority}</dt> 95 <dd>The priority that should be given to the parent component with regard 96 to handling intents of the type described by the filter. This attribute has 97 meaning for both activities and broadcast receivers: 98 99 <ul> 100 <li>It provides information about how able an activity is to respond to 101 an intent that matches the filter, relative to other activities that could 102 also respond to the intent. When an intent could be handled by multiple 103 activities with different priorities, Android will consider only those with 104 higher priority values as potential targets for the intent.</li> 105 106 <li><p>It controls the order in which broadcast receivers are executed to 107 receive broadcast messages. Those with higher priority 108 values are called before those with lower values. (The order applies only 109 to synchronous messages; it's ignored for asynchronous messages.)</p></li> 110 </ul> 111 112 <p> 113 Use this attribute only if you really need to impose a specific order in 114 which the broadcasts are received, or want to force Android to prefer 115 one activity over others. 116 </p> 117 118 <p> 119 The value must be an integer, such as "{@code 100}". Higher numbers have a 120 higher priority. 121 </p></dd> 122 123 </dl></dd> 124 125 <!-- ##api level indication## --> 126 <dt>introduced in:</dt> 127 <dd>API Level 1</dd> 128 129 <dt>see also:</dt> 130 <dd><code><a href="{@docRoot}guide/topics/manifest/action-element.html"><action></a></code> 131 <br/><code><a href="{@docRoot}guide/topics/manifest/category-element.html"><category></a></code> 132 <br/><code><a href="{@docRoot}guide/topics/manifest/data-element.html"><data></a></code></dd> 133 134 </dl> 135