• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1page.title=<activity-alias>
2parent.title=The AndroidManifest.xml File
3parent.link=manifest-intro.html
4@jd:body
5
6<dl class="xml">
7<dt>syntax:</dt>
8<dd><pre class="stx">&lt;activity-alias android:<a href="#enabled">enabled</a>=["true" | "false"]
9                android:<a href="#exported">exported</a>=["true" | "false"]
10                android:<a href="#icon">icon</a>="<i>drawable resource</i>"
11                android:<a href="#label">label</a>="<i>string resource</i>"
12                android:<a href="#nm">name</a>="<i>string</i>"
13                android:<a href="#prmsn">permission</a>="<i>string</i>"
14                android:<a href="#trgt">targetActivity</a>="<i>string</i>" &gt;
15    . . .
16&lt;/activity-alias&gt;</pre></dd>
17
18<dt>contained in:</dt>
19<dd><code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code></dd>
20
21<dt>can contain:</dt>
22<dd><code><a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">&lt;intent-filter&gt;</a></code>
23<br/><code><a href="{@docRoot}guide/topics/manifest/meta-data-element.html">&lt;meta-data&gt;</a></code></dd>
24
25<dt>description:</dt>
26<dd>An alias for an activity, named by the {@code targetActivity}
27attribute.  The target must be in the same application as the
28alias and it must be declared before the alias in the manifest.
29
30<p>
31The alias presents the target activity as a independent entity.
32It can have its own set of intent filters, and they, rather than the
33intent filters on the target activity itself, determine which intents
34can activate the target through the alias and how the system
35treats the alias.  For example, the intent filters on the alias may
36specify the "<code>{@link android.content.Intent#ACTION_MAIN
37android.intent.action.MAIN}</code>"
38and "<code>{@link android.content.Intent#CATEGORY_LAUNCHER
39android.intent.category.LAUNCHER}</code>" flags, causing it to be
40represented in the application launcher, even though none of the
41filters on the target activity itself set these flags.
42</p>
43
44<p>
45With the exception of {@code targetActivity}, {@code &lt;activity-alias&gt;}
46attributes are a subset of <code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code> attributes.
47For attributes in the subset, none of the values set for the target carry over
48to the alias.  However, for attributes not in the subset, the values set for
49the target activity also apply to the alias.
50</p></dd>
51
52<dt>attributes:</dt>
53<dd><dl class="attr">
54<dt><a name="enabled"></a>{@code android:enabled}</dt>
55<dd>Whether or not the target activity can be instantiated by the system through
56this alias &mdash; "{@code true}" if it can be, and "{@code false}" if not.
57The default value is "{@code true}".
58
59<p>
60The <code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code> element has its own
61<code><a href="{@docRoot}guide/topics/manifest/application-element.html#enabled">enabled</a></code> attribute that applies to all
62application components, including activity aliases.  The
63<code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code> and {@code &lt;activity-alias&gt;}
64attributes must both be "{@code true}" for the system to be able to instantiate
65the target activity through the alias.  If either is "{@code false}", the alias
66does not work.
67</p></dd>
68
69<dt><a name="exported"></a>{@code android:exported}</dt>
70<dd>Whether or not components of other applications can launch the target activity
71through this alias &mdash; "{@code true}" if they can, and "{@code false}" if not.
72If "{@code false}", the target activity can be launched through the alias only by
73components of the same application as the alias or applications with the same user ID.
74
75<p>
76The default value depends on whether the alias contains intent filters.  The
77absence of any filters means that the activity can be invoked through the alias
78only by specifying the exact name of the alias.  This implies that the alias
79is intended only for application-internal use (since others would not know its name)
80&mdash; so the default value is "{@code false}".
81On the other hand, the presence of at least one filter implies that the alias
82is intended for external use &mdash; so the default value is "{@code true}".
83</p></dd>
84
85<dt><a name="icon"></a>{@code android:icon}</dt>
86<dd>An icon for the target activity when presented to users through the alias.
87See the <code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code> element's
88<code><a href="{@docRoot}guide/topics/manifest/activity-element.html#icon">icon</a></code> attribute for more information.
89
90<dt><a name="label"></a>{@code android:label}</dt>
91<dd>A user-readable label for the alias when presented to users through the alias.
92See the the <code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code> element's
93<code><a href="{@docRoot}guide/topics/manifest/activity-element.html#label">label</a></code> attribute for more information.
94</p></dd>
95
96<dt><a name="nm">{@code android:name}</dt>
97<dd>A unique name for the alias.  The name should resemble a fully
98qualified class name.  But, unlike the name of the target activity,
99the alias name is arbitrary; it does not refer to an actual class.
100</p></dd>
101
102<dt><a name="prmsn"></a>{@code android:permission}</dt>
103<dd>The name of a permission that clients must have to launch the target activity
104or get it to do something via the alias.  If a caller of
105<code>{@link android.content.Context#startActivity startActivity()}</code> or
106<code>{@link android.app.Activity#startActivityForResult startActivityForResult()}</code>
107has not been granted the specified permission, the target activity will not be
108activated.
109
110<p>This attribute supplants any permission set for the target activity itself.  If
111it is not set, a permission is not needed to activate the target through the alias.
112</p>
113
114<p>
115For more information on permissions, see the
116<a href="{@docRoot}guide/topics/manifest/manifest-intro.html#perms">Permissions</a>
117section in the introduction.
118</p></dd>
119
120<dt><a name="trgt"></a>{@code android:targetActivity}</dt>
121<dd>The name of the activity that can be activated through the alias.
122This name must match the {@code name} attribute of an
123<code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code> element that precedes
124the alias in the manifest.
125</p></dd>
126</dl></dd>
127
128<!-- ##api level indication## -->
129<dt>introduced in:</dt>
130<dd>API Level 1</dd>
131
132<dt>see also:</dt>
133<dd><code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code></dd>
134
135</dl>