OSDN Git Service

original
[gb-231r1-is01/Gingerbread_2.3.3_r1_IS01.git] / frameworks / base / docs / html / guide / topics / manifest / action-element.jd
1 page.title=<action>
2 @jd:body
3
4 <dl class="xml">
5 <dt>syntax:</dt>
6 <dd><pre class="stx">&lt;action android:<a href="#nm">name</a>="<i>string</i>" /&gt;</pre></dd>
7
8 <dt>contained in:</dt>
9 <dd><code><a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">&lt;intent-filter&gt;</a></code></dd>
10
11 <p>
12 <dt>description:</dt>
13 <dd>Adds an action to an intent filter. 
14 An <code><a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">&lt;intent-filter&gt;</a></code> element must contain 
15 one or more {@code &lt;action&gt;} elements.  If it doesn't contain any, no
16 Intent objects will get through the filter.  See 
17 <a href="{@docRoot}guide/topics/intents/intents-filters.html">Intents and 
18 Intent Filters</a> for details on intent filters and the role of action
19 specifications within a filter.
20 </dd>
21
22 <dt>attributes:</dt>
23 <dd><dl class="attr">
24 <dt><a name="nm"></a>{@code android:name}</dt>
25 <dd>The name of the action.  Some standard actions are defined in the
26 {@link android.content.Intent#ACTION_CHOOSER Intent} class as 
27 {@code ACTION_<i>string</i>} constants.  To assign one of these actions to 
28 this attribute, prepend "{@code android.intent.action.}" to the 
29 {@code <i>string</i>} that follows {@code ACTION_}.
30 For example, for {@code ACTION_MAIN}, use "{@code android.intent.action.MAIN}"
31 and for {@code ACTION_WEB_SEARCH}, use "{@code android.intent.action.WEB_SEARCH}".
32
33 <p>
34 For actions you define, it's best to use the package name as a prefix to
35 ensure uniqueness.  For example, a {@code TRANSMOGRIFY} action might be specified 
36 as follows:
37 </p>
38
39 <pre>&lt;action android:name="com.example.project.TRANSMOGRIFY" /&gt;</pre>
40 </dd>
41 </dl></dd>
42
43 <!-- ##api level indication## -->
44 <dt>introduced in:</dt>
45 <dd>API Level 1</dd>
46
47 <dt>see also:</dt>
48 <dd><code><a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">&lt;intent-filter&gt;</a></code></dd>
49
50 </dl>