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