1page.title=<activity>
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 android:<a href="#reparent">allowTaskReparenting</a>=["true" | "false"]
9          android:<a href="#always">alwaysRetainTaskState</a>=["true" | "false"]
10          android:<a href="#clear">clearTaskOnLaunch</a>=["true" | "false"]
11          android:<a href="#config">configChanges</a>=["mcc", "mnc", "locale",
12                                 "touchscreen", "keyboard", "keyboardHidden",
13                                 "navigation", "screenLayout", "fontScale", "uiMode",
14                                 "orientation", "screenSize", "smallestScreenSize"]
15          android:<a href="#enabled">enabled</a>=["true" | "false"]
16          android:<a href="#exclude">excludeFromRecents</a>=["true" | "false"]
17          android:<a href="#exported">exported</a>=["true" | "false"]
18          android:<a href="#finish">finishOnTaskLaunch</a>=["true" | "false"]
19          android:<a href="#hwaccel">hardwareAccelerated</a>=["true" | "false"]
20          android:<a href="#icon">icon</a>="<i>drawable resource</i>"
21          android:<a href="#label">label</a>="<i>string resource</i>"
22          android:<a href="#lmode">launchMode</a>=["multiple" | "singleTop" |
23                              "singleTask" | "singleInstance"]
24          android:<a href="#multi">multiprocess</a>=["true" | "false"]
25          android:<a href="#nm">name</a>="<i>string</i>"
26          android:<a href="#nohist">noHistory</a>=["true" | "false"]  <!-- ##api level 3## -->
27          android:<a href="#parent">parentActivityName</a>="<i>string</i>" <!-- api level 16 -->
28          android:<a href="#prmsn">permission</a>="<i>string</i>"
29          android:<a href="#proc">process</a>="<i>string</i>"
30          android:<a href="#screen">screenOrientation</a>=["unspecified" | "user" | "behind" |
31                                     "landscape" | "portrait" |
32                                     "reverseLandscape" | "reversePortrait" |
33                                     "sensorLandscape" | "sensorPortrait" |
34                                     "sensor" | "fullSensor" | "nosensor"]
35          android:<a href="#state">stateNotNeeded</a>=["true" | "false"]
36          android:<a href="#aff">taskAffinity</a>="<i>string</i>"
37          android:<a href="#theme">theme</a>="<i>resource or theme</i>"
38          android:<a href="#uioptions">uiOptions</a>=["none" | "splitActionBarWhenNarrow"]
39          android:<a href="#wsoft">windowSoftInputMode</a>=["stateUnspecified",
40                                       "stateUnchanged", "stateHidden",
41                                       "stateAlwaysHidden", "stateVisible",
42                                       "stateAlwaysVisible", "adjustUnspecified",
43                                       "adjustResize", "adjustPan"] &gt;   <!-- ##api level 3## -->
44    . . .
45&lt;/activity&gt;</pre></dd>
46
47<dt>contained in:</dt>
48<dd><code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code></dd>
49
50<dt>can contain:</dt>
51<dd><code><a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">&lt;intent-filter&gt;</a></code>
52<br/><code><a href="{@docRoot}guide/topics/manifest/meta-data-element.html">&lt;meta-data&gt;</a></code></dd>
53
54<dt>description:</dt>
55<dd>Declares an activity (an {@link android.app.Activity} subclass) that 
56implements part of the application's visual user interface.  All activities 
57must be represented by {@code &lt;activity&gt;} 
58elements in the manifest file.  Any that are not declared there will not be seen 
59by the system and will never be run.
60
61<dt>attributes:</dt>
62<dd><dl class="attr">
63<dt><a name="reparent"></a>{@code android:allowTaskReparenting}</dt>
64<dd>Whether or not the activity can move from the task that started it to 
65the task it has an affinity for when that task is next brought to the 
66front &mdash; "{@code true}" if it can move, and "{@code false}" if it 
67must remain with the task where it started.  
68
69<p>
70If this attribute is not set, the value set by the corresponding 
71<code><a href="{@docRoot}guide/topics/manifest/application-element.html#reparent">allowTaskReparenting</a></code>
72attribute of the <code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code> element 
73applies to the activity.  The default value is "{@code false}".
74</p>
75
76<p>
77Normally when an activity is started, it's associated with the task of 
78the activity that started it and it stays there for its entire lifetime.  
79You can use this attribute to force it to be re-parented to the task it 
80has an affinity for when its current task is no longer displayed.  
81Typically, it's used to cause the activities of an application to move 
82to the main task associated with that application.
83</p>
84
85<p>
86For example, if an e-mail message contains a link to a web page, clicking 
87the link brings up an activity that can display the page.  That activity 
88is defined by the browser application, but is launched as part of the e-mail 
89task.  If it's reparented to the browser task, it will be shown when the 
90browser next comes to the front, and will be absent when the e-mail task 
91again comes forward.
92</p>
93
94<p>
95The affinity of an activity is defined by the 
96<code><a href="#aff">taskAffinity</a></code> attribute.  The affinity 
97of a task is determined by reading the affinity of its root activity.
98Therefore, by definition, a root activity is always in a task with the
99same affinity.  Since activities with "{@code singleTask}" or 
100"{@code singleInstance}" launch modes can only be at the root of a task,
101re-parenting is limited to the "{@code standard}" and "{@code singleTop}" 
102modes.  (See also the <code><a href="#lmode">launchMode</a></code> 
103attribute.)
104</p></dd>
105
106<dt><a name="always"></a>{@code android:alwaysRetainTaskState}</dt>
107<dd>Whether or not the state of the task that the activity is in will always 
108be maintained by the system &mdash; "{@code true}" if it will be, and 
109"{@code false}" if the system is allowed to reset the task to its initial 
110state in certain situations.  The default value is "{@code false}".  This 
111attribute is meaningful only for the root activity of a task; it's ignored 
112for all other activities.
113
114<p>
115Normally, the system clears a task (removes all activities from the stack 
116above the root activity) in certain situations when the user re-selects that 
117task from the home screen.  Typically, this is done if the user hasn't visited 
118the task for a certain amount of time, such as 30 minutes.
119</p>
120
121<p>
122However, when this attribute is "{@code true}", users will always return 
123to the task in its last state, regardless of how they get there.  This is 
124useful, for example, in an application like the web browser where there is 
125a lot of state (such as multiple open tabs) that users would not like to lose.
126</p></dd>
127
128<dt><a name="clear"></a>{@code android:clearTaskOnLaunch}</dt>
129<dd>Whether or not all activities will be removed from the task, except for 
130the root activity, whenever it is re-launched from the home screen &mdash; 
131"{@code true}" if the task is always stripped down to its root activity, and 
132"{@code false}" if not.  The default value is "{@code false}".  This attribute 
133is meaningful only for activities that start a new task (the root activity); 
134it's ignored for all other activities in the task.
135
136<p>
137When the value is "{@code true}", every time users start the task again, they
138are brought to its root activity regardless of what they were last doing in
139the task and regardless of whether they used the <em>Back</em> or <em>Home</em> button to
140leave it. When the value is "{@code false}", the task may be cleared of activities in
141some situations (see the 
142<code><a href="#always">alwaysRetainTaskState</a></code> attribute), but not always.  
143</p>
144
145<p>
146Suppose, for example, that someone launches activity P from the home screen, 
147and from there goes to activity Q.  The user next presses <em>Home</em>, and then returns 
148to activity P.  Normally, the user would see activity Q, since that is what they 
149were last doing in P's task.  However, if P set this flag to "{@code true}", all 
150of the activities on top of it (Q in this case) were removed when the user pressed 
151<em>Home</em> and the task went to the background.  So the user sees only P when returning 
152to the task.
153</p>
154
155<p>
156If this attribute and <code><a href="#reparent">allowTaskReparenting</a></code> 
157are both "{@code true}", any activities that can be re-parented are moved to 
158the task they share an affinity with; the remaining activities are then dropped, 
159as described above.
160</p></dd>
161
162<dt><a name="config"></a>{@code android:configChanges}</dt>
163<dd>Lists configuration changes that the activity will handle itself.  When a configuration
164change occurs at runtime, the activity is shut down and restarted by default, but declaring a
165configuration with this attribute will prevent the activity from being restarted. Instead, the
166activity remains running and its <code>{@link android.app.Activity#onConfigurationChanged
167onConfigurationChanged()}</code> method is called.
168
169<p class="note"><strong>Note:</strong> Using this attribute should be
170avoided and used only as a last-resort. Please read <a
171href="{@docRoot}guide/topics/resources/runtime-changes.html">Handling Runtime Changes</a> for more
172information about how to properly handle a restart due to a configuration change.</p>
173
174<p>
175Any or all of the following strings are valid values for this attribute. Multiple values are
176separated by '{@code |}' &mdash; for example, "{@code locale|navigation|orientation}".
177</p>
178
179<table>
180<tr>
181   <th>Value</th>
182   <th>Description</th>
183</tr><tr>
184   <td>"{@code mcc}"</td>
185   <td>The IMSI mobile country code (MCC) has changed &mdash;
186       a SIM has been detected and updated the MCC.</td>
187</tr><tr>
188   <td>"{@code mnc}"</td>
189   <td>The IMSI mobile network code (MNC) has changed &mdash;
190       a SIM has been detected and updated the MNC.</td>
191</tr><tr>
192   <td>"{@code locale}"</td>
193   <td>The locale has changed &mdash; the user has selected a new
194       language that text should be displayed in.</td>
195</tr><tr>
196   <td>"{@code touchscreen}"</td>
197   <td>The touchscreen has changed.  (This should never normally happen.)</td>
198</tr><tr>
199   <td>"{@code keyboard}"</td>
200   <td>The keyboard type has changed &mdash; for example, the user has
201       plugged in an external keyboard.</td>
202</tr><tr>
203   <td>"{@code keyboardHidden}"</td>
204   <td>The keyboard accessibility has changed &mdash; for example, the
205       user has revealed the hardware keyboard.</td>
206</tr><tr>
207   <td>"{@code navigation}"</td>
208   <td>The navigation type (trackball/dpad) has changed.  (This should never normally happen.)</td>
209</tr><tr>
210   <td>"{@code screenLayout}"</td>
211   <td>The screen layout has changed &mdash; this might be caused by a
212             different display being activated.</td>
213 </tr><tr>
214  <td>"{@code fontScale}"</td>
215   <td>The font scaling factor has changed &mdash; the user has selected
216       a new global font size.</td>
217  </tr><tr>
218  <td>"{@code uiMode}"</td>
219   <td>The user interface mode has changed &mdash; this can be caused when the user places the
220device into a desk/car dock or when the the night mode changes. See {@link
221android.app.UiModeManager}. <em>Introduced in API Level 8</em>.</td>
222  </tr><tr>
223   <td>"{@code orientation}"</td>
224   <td>The screen orientation has changed &mdash; the user has rotated the device. 
225       <p class="note"><strong>Note:</strong> If your application targets API level 13 or higher (as
226declared by the <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code
227minSdkVersion}</a> and <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
228targetSdkVersion}</a> attributes), then you should also declare the {@code "screenSize"}
229configuration, because it also changes when a device switches between portrait and landscape
230orientations.</p></td>
231 </tr><tr>
232   <td>"{@code screenSize}"</td>
233   <td>The current available screen size has changed. This represents a change in the currently
234available size, relative to the current aspect ratio, so will change when the user switches between
235landscape and portrait. However, if your application targets API level 12 or lower, then your
236activity always handles this configuration change itself (this configuration change does not restart
237your activity, even when running on an Android 3.2 or higher device).
238  <p><em>Added in API level 13.</em></p></td>
239 </tr><tr>
240   <td>"{@code smallestScreenSize}"</td>
241   <td>The physical screen size has changed. This represents a change in size regardless of
242orientation, so will only change when the actual physical screen size has changed such as switching
243to an external display. A change to this configuration corresponds to a change in the <a
244href="{@docRoot}guide/topics/resources/providing-resources.html#SmallestScreenWidthQualifier">
245smallestWidth configuration</a>. However, if your application targets API level 12 or lower, then
246your activity always handles this configuration change itself (this configuration change does not
247restart your activity, even when running on an Android 3.2 or higher device).
248  <p><em>Added in API level 13.</em></p></td>
249 </tr>
250</table>
251
252<p>
253All of these configuration changes can impact the resource values seen by the 
254application.  Therefore, when <code>{@link android.app.Activity#onConfigurationChanged 
255onConfigurationChanged()}</code> is called, it will generally be necessary to again 
256retrieve all resources (including view layouts, drawables, and so on) to correctly 
257handle the change. 
258</p></dd>
259
260<dt><a name="enabled"></a>{@code android:enabled}</dt>
261<dd>Whether or not the activity can be instantiated by the system &mdash; 
262"{@code true}" if it can be, and "{@code false}" if not.  The default value 
263is "{@code true}".
264
265<p>
266The <code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code> element has its own 
267<code><a href="{@docRoot}guide/topics/manifest/application-element.html#enabled">enabled</a></code> 
268attribute that applies to all application components, including activities.  The 
269<code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code> 
270and {@code &lt;activity&gt;} attributes must both be "{@code true}" (as they both 
271are by default) for the system to be able to instantiate the activity.  If either 
272is "{@code false}", it cannot be instantiated.
273</p></dd>
274
275<dt><a name="exclude"></a>{@code android:excludeFromRecents}</dt>
276<dd>Whether or not the task initiated by this activity should be excluded from the list of recently
277used applications ("recent apps"). That is, when this activity is the root activity of a new task,
278this attribute determines whether the task should not appear in the list of recent apps. "{@code
279true}" if the task should be <em>excluded</em> from the list; "{@code false}" if it should be
280<em>included</em>. The default value is "{@code false}".
281</p></dd>
282
283<dt><a name="exported"></a>{@code android:exported}</dt>
284<dd>Whether or not the activity can be launched by components of other 
285applications &mdash; "{@code true}" if it can be, and "{@code false}" if not.  
286If "{@code false}", the activity can be launched only by components of the 
287same application or applications with the same user ID.  
288
289<p>
290The default value depends on whether the activity contains intent filters.  The 
291absence of any filters means that the activity can be invoked only by specifying 
292its exact class name.  This implies that the activity is intended only for 
293application-internal use (since others would not know the class name).  So in 
294this case, the default value is "{@code false}".
295On the other hand, the presence of at least one filter implies that the activity 
296is intended for external use, so the default value is "{@code true}".
297</p>
298
299<p>
300This attribute is not the only way to limit an activity's exposure to other
301applications.  You can also use a permission to limit the external entities that 
302can invoke the activity  (see the 
303<code><a href="{@docRoot}guide/topics/manifest/activity-element.html#prmsn">permission</a></code> 
304attribute).
305</p></dd>
306
307<dt><a name="finish"></a>{@code android:finishOnTaskLaunch}</dt>
308<dd>Whether or not an existing instance of the activity should be shut down 
309(finished) whenever the user again launches its task (chooses the task on the 
310home screen) &mdash; "{@code true}" if it should be shut down, and "{@code false}" 
311if not. The default value is "{@code false}".
312
313<p>
314If this attribute and 
315<code><a href="{@docRoot}guide/topics/manifest/activity-element.html#reparent">allowTaskReparenting</a></code> 
316are both "{@code true}", this attribute trumps the other.  The affinity of the 
317activity is ignored.  The activity is not re-parented, but destroyed.
318</p>
319
320<dt><a name="hwaccel"></a>{@code android:hardwareAccelerated}</dt>
321<dd>Whether or not hardware-accelerated rendering should be enabled for this
322Activity &mdash; "{@code true}" if it should be enabled, and "{@code false}" if
323not. The default value is "{@code false}".
324
325
326<p>Starting from Android 3.0, a hardware-accelerated OpenGL renderer is
327available to applications, to improve performance for many common 2D graphics
328operations. When the hardware-accelerated renderer is enabled, most operations
329in Canvas, Paint, Xfermode, ColorFilter, Shader, and Camera are accelerated.
330This results in smoother animations, smoother scrolling, and improved
331responsiveness overall, even for applications that do not explicitly make use
332the framework's OpenGL libraries. Because of the increased resources required to
333enable hardware acceleration, your app will consume more RAM.</p>
334
335<p>Note that not all of the OpenGL 2D operations are accelerated. If you enable
336the hardware-accelerated renderer, test your application to ensure that it can
337make use of the renderer without errors.</p>
338</dd>
339
340<dt><a name="icon"></a>{@code android:icon}</dt>
341<dd>An icon representing the activity. The icon is displayed to users when 
342a representation of the activity is required on-screen.  For example, icons 
343for activities that initiate tasks are displayed in the launcher window.  
344The icon is often accompanied by a label (see the <a href="#label">{@code
345android:label}</a> attribute).
346</p>
347
348<p>
349This attribute must be set as a reference to a drawable resource containing 
350the image definition.  If it is not set, the icon specified for the application 
351as a whole is used instead (see the 
352<code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code> 
353element's <code><a href="{@docRoot}guide/topics/manifest/application-element.html#icon">icon</a></code> attribute).
354</p>
355
356<p>
357The activity's icon &mdash; whether set here or by the 
358<code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code> 
359element &mdash; is also the default icon for all the activity's intent filters (see the 
360<code><a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">&lt;intent-filter&gt;</a></code> element's 
361<code><a href="{@docRoot}guide/topics/manifest/intent-filter-element.html#icon">icon</a></code> attribute). 
362</p></dd>
363
364<dt><a name="label"></a>{@code android:label}</dt>
365<dd>A user-readable label for the activity.  The label is displayed on-screen 
366when the activity must be represented to the user. It's often displayed along 
367with the activity icon.
368
369<p>
370If this attribute is not set, the label set for the application as a whole is 
371used instead (see the <code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code> element's 
372<code><a href="{@docRoot}guide/topics/manifest/application-element.html#label">label</a></code> attribute).
373</p>
374
375<p>
376The activity's label &mdash; whether set here or by the 
377<code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code> element &mdash; is also the 
378default label for all the activity's intent filters (see the 
379<code><a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">&lt;intent-filter&gt;</a></code> element's 
380<code><a href="{@docRoot}guide/topics/manifest/intent-filter-element.html#label">label</a></code> attribute). 
381</p>
382
383<p>
384The label should be set as a reference to a string resource, so that
385it can be localized like other strings in the user interface.  
386However, as a convenience while you're developing the application, 
387it can also be set as a raw string.
388</p></dd>
389
390<dt><a name="lmode"></a>{@code android:launchMode}</dt>
391<dd>An instruction on how the activity should be launched.  There are four modes
392that work in conjunction with activity flags ({@code FLAG_ACTIVITY_*} constants) 
393in {@link android.content.Intent} objects to determine what should happen when
394the activity is called upon to handle an intent. They are:</p>
395
396<p style="margin-left: 2em">"{@code standard}"
397<br>"{@code singleTop}"
398<br>"{@code singleTask}"
399<br>"{@code singleInstance}"</p>
400
401<p>
402The default mode is "{@code standard}".
403</p>
404
405<p>
406As shown in the table below, the modes fall into two main groups, with
407"{@code standard}" and "{@code singleTop}" activities on one side, and
408"{@code singleTask}" and "{@code singleInstance}" activities on the other.
409An activity with the "{@code standard}" or "{@code singleTop}" launch mode
410can be instantiated multiple times.  The instances can belong to any task
411and can be located anywhere in the activity stack.  Typically, they're
412launched into the task that called 
413<code>{@link android.content.Context#startActivity startActivity()}</code>
414(unless the Intent object contains a
415<code>{@link android.content.Intent#FLAG_ACTIVITY_NEW_TASK}</code>
416instruction, in which case a different task is chosen &mdash; see the
417<a href="#aff">taskAffinity</a> attribute).
418</p>
419
420<p>
421In contrast, "<code>singleTask</code>" and "<code>singleInstance</code>" activities
422can only begin a task.  They are always at the root of the activity stack.
423Moreover, the device can hold only one instance of the activity at a time
424&mdash; only one such task.
425</p>
426
427<p>
428The "{@code standard}" and "{@code singleTop}" modes differ from each other 
429in just one respect:  Every time there's a new intent for a "{@code standard}"
430activity, a new instance of the class is created to respond to that intent.
431Each instance handles a single intent.
432Similarly, a new instance of a "{@code singleTop}" activity may also be
433created to handle a new intent.  However, if the target task already has an
434existing instance of the activity at the top of its stack, that instance
435will receive the new intent (in an
436<code>{@link android.app.Activity#onNewIntent onNewIntent()}</code> call);
437a new instance is not created.
438In other circumstances &mdash; for example, if an existing instance of the
439"{@code singleTop}" activity is in the target task, but not at the top of
440the stack, or if it's at the top of a stack, but not in the target task
441&mdash; a new instance would be created and pushed on the stack.
442</p>
443
444<p>
445The "{@code singleTask}" and "{@code singleInstance}" modes also differ from
446each other in only one respect:  A "{@code singleTask}" activity allows other
447activities to be part of its task. It's always at the root of its task, but
448other activities (necessarily "{@code standard}" and "{@code singleTop}"
449activities) can be launched into that task.  A "{@code singleInstance}"
450activity, on the other hand, permits no other activities to be part of its task.
451It's the only activity in the task.  If it starts another activity, that
452activity is assigned to a different task &mdash; as if {@code
453FLAG_ACTIVITY_NEW_TASK} was in the intent.
454</p>
455
456<table>
457<tr>
458<th>Use Cases</th>
459<th>Launch Mode</th>
460<th>Multiple Instances?</th>
461<th>Comments</th>
462</tr>
463<tr>
464<td rowspan="2" style="width:20%;">Normal launches for most activities</td>
465<td>"<code>standard</code>"</td>
466<td>Yes</td>
467<td>Default. The system always creates a new instance of the activity in the
468target task and routes the intent to it.</td>
469</tr>
470<tr>
471<td>"<code>singleTop</code>"</td>
472<td>Conditionally</td>
473<td>If an instance of the activity already exists at the top of the target task,
474the system routes the intent to that instance through a call to its {@link
475android.app.Activity#onNewIntent onNewIntent()} method, rather than creating a
476new instance of the activity.</td>
477</tr>
478<tr>
479<td rowspan="2">Specialized launches<br>
480<em>(not recommended for general use)</em></td>
481<td>"<code>singleTask</code>"</td>
482<td>No</td>
483<td>The system creates the activity at the root of a new task and routes the
484intent to it. However, if an instance of the activity already exists, the system
485routes the intent to existing instance through a call to its {@link
486android.app.Activity#onNewIntent onNewIntent()} method, rather than creating a
487new one.</td>
488</tr>
489<tr>
490<td>"<code>singleInstance</code>"</td>
491<td>No</td>
492<td>Same as "<code>singleTask"</code>, except that the system doesn't launch any
493other activities into the task holding the instance. The activity is always the
494single and only member of its task.</td>
495</tr>
496</table>
497
498<p>As shown in the table above, <code>standard</code> is the default mode and is
499appropriate for most types of activities. <code>SingleTop</code> is also a
500common and useful launch mode for many types of activities. The other modes
501&mdash; <code>singleTask</code> and <code>singleInstance</code> &mdash; are
502<span style="color:red">not appropriate for most applications</span>,
503since they result in an interaction model that is likely to be unfamiliar to
504users and is very different from most other applications. 
505
506<p>Regardless of the launch mode that you choose, make sure to test the usability
507of the activity during launch and when navigating back to it from
508other activities and tasks using the <em>Back</em> button. </p>
509
510<p>For more information on launch modes and their interaction with Intent
511flags, see the 
512<a href="{@docRoot}guide/components/tasks-and-back-stack.html">Tasks and Back Stack</a>
513document.
514</p>
515</dd>
516
517<dt><a name="multi"></a>{@code android:multiprocess}</dt>
518<dd>Whether an instance of the activity can be launched into the process of the component 
519that started it &mdash; "{@code true}" if it can be, and "{@code false}" if not.  
520The default value is "{@code false}".
521
522<p>
523Normally, a new instance of an activity is launched into the process of the 
524application that defined it, so all instances of the activity run in the same 
525process.  However, if this flag is set to "{@code true}", instances of the 
526activity can run in multiple processes, allowing the system to create instances 
527wherever they are used (provided permissions allow it), something that is almost 
528never necessary or desirable.
529</p></dd>
530
531<dt><a name="nm"></a>{@code android:name}</dt>
532<dd>The name of the class that implements the activity, a subclass of 
533{@link android.app.Activity}.  The attribute value should be a fully qualified 
534class name (such as, "{@code com.example.project.ExtracurricularActivity}").  
535However, as a shorthand, if the first character of the name is a period 
536(for example, "{@code .ExtracurricularActivity}"), it is appended to the 
537package name specified in the 
538<code><a href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a></code> 
539element.
540<p>Once you publish your application, you <a
541href="http://android-developers.blogspot.com/2011/06/things-that-cannot-change.html">should not
542change this name</a> (unless you've set <code><a
543href="#exported">android:exported</a>="false"</code>).</p>
544
545<p>
546There is no default.  The name must be specified.
547</p></dd>
548
549<!-- ##api level 3## -->
550<dt><a name="nohist"></a>{@code android:noHistory}</dt>
551<dd>Whether or not the activity should be removed from the activity stack and
552finished (its <code>{@link android.app.Activity#finish finish()}</code> 
553method called) when the user navigates away from it and it's no longer 
554visible on screen &mdash; "{@code true}" if it should be finished, and 
555"{@code false}" if not.  The default value is "{@code false}".
556
557<p>
558A value of "{@code true}" means that the activity will not leave a
559historical trace.  It will not remain in the activity stack for the task,
560so the user will not be able to return to it.
561</p>
562
563<p>
564This attribute was introduced in API Level 3.
565</p>
566</dd>
567
568<!-- api level 16 -->
569<dt><a name="parent"></a>{@code android:parentActivityName}</dt>
570<dd>The class name of the logical parent of the activity. The name here must be formatted
571  the same as the corresponding activity is declared in its own
572  <a href="#nm">android:name</a>.
573  
574<p>The system reads this attribute to determine which activity should be started when
575  the use presses the Up button in the action bar. The system can also use this information to
576  synthesize a back stack of activities with {@link android.app.TaskStackBuilder}.</p>
577
578<p>
579This attribute was introduced in API Level 16.
580</p>
581</dd>
582
583
584
585<dt><a name="prmsn"></a>{@code android:permission}</dt>
586<dd>The name of a permission that clients must have to launch the activity 
587or otherwise get it to respond to an intent.  If a caller of 
588<code>{@link android.content.Context#startActivity startActivity()}</code> or
589<code>{@link android.app.Activity#startActivityForResult startActivityForResult()}</code>
590has not been granted the specified permission, its intent will not be 
591delivered to the activity.
592
593<p>
594If this attribute is not set, the permission set by the 
595<code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code> 
596element's
597<code><a href="{@docRoot}guide/topics/manifest/application-element.html#prmsn">permission</a></code> 
598attribute applies to the activity.  If neither attribute is set, the activity is
599not protected by a permission.
600</p>
601
602<p>
603For more information on permissions, see the 
604<a href="{@docRoot}guide/topics/manifest/manifest-intro.html#sectperm">Permissions</a> 
605section in the introduction and another document, 
606<a href="{@docRoot}guide/topics/security/security.html">Security and
607Permissions</a>.
608</p></dd>
609
610<dt><a name="proc"></a>{@code android:process}</dt>
611<dd>The name of the process in which the activity should run. Normally, 
612all components of an application run in the default process created for the 
613application.  It has the same name as the application package. The <code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code> element's 
614<code><a href="{@docRoot}guide/topics/manifest/application-element.html#proc">process</a></code> 
615attribute can set a different default for all components.  But each component 
616can override the default, allowing you to spread your application across 
617multiple processes.
618
619<p>
620If the name assigned to this attribute begins with a colon (':'), a new 
621process, private to the application, is created when it's needed and 
622the activity runs in that process.
623If the process name begins with a lowercase character, the activity will run 
624in a global process of that name, provided that it has permission to do so.
625This allows components in different applications to share a process, reducing 
626resource usage.
627</p></dd>
628
629<dt><a name="screen"></a>{@code android:screenOrientation}</dt>
630<dd>The orientation of the activity's display on the device. 
631  
632<p>The value can be any one of the following strings:</p>
633
634<table>
635<tr>
636   <td>"{@code unspecified}"</td>
637   <td>The default value.  The system chooses the orientation.  The policy it
638       uses, and therefore the choices made in specific contexts, may differ 
639       from device to device.</td>
640</tr><tr>
641   <td>"{@code user}"</td>
642   <td>The user's current preferred orientation.</td>
643</tr><tr>
644   <td>"{@code behind}"</td>
645   <td>The same orientation as the activity that's immediately beneath it in 
646       the activity stack.</td>
647</tr><tr>
648   <td>"{@code landscape}"</td>
649   <td>Landscape orientation (the display is wider than it is tall).</td>
650</tr><tr>
651   <td>"{@code portrait}"</td>
652   <td>Portrait orientation (the display is taller than it is wide).</td>
653</tr><tr>
654   <td>"{@code reverseLandscape}"</td>
655   <td>Landscape orientation in the opposite direction from normal landscape.
656<em>Added in API level 9.</em></td>
657</tr><tr>
658   <td>"{@code reversePortrait}"</td>
659   <td>Portrait orientation in the opposite direction from normal portrait.
660<em>Added in API level 9.</em></td>
661</tr><tr>
662   <td>"{@code sensorLandscape}"</td>
663   <td>Landscape orientation, but can be either normal or reverse landscape based on the device
664sensor.
665<em>Added in API level 9.</em></td>
666</tr><tr>
667   <td>"{@code sensorPortrait}"</td>
668   <td>Portrait orientation, but can be either normal or reverse portrait based on the device
669sensor.
670<em>Added in API level 9.</em></td>
671</tr><tr>
672   <td>"{@code sensor}"</td>
673   <td>The orientation is determined by the device orientation sensor.  The orientation of the
674display depends on how the user is holding the device; it changes when the user rotates the
675device. Some devices, though, will not rotate to all four possible orientations, by default. To
676allow all four orientations, use {@code "fullSensor"}.</td>
677</tr><tr>
678   <td>"{@code fullSensor}"</td>
679   <td>The orientation is determined by the device orientation sensor for any of the 4 orientations.
680This is similar to {@code "sensor"} except this allows any of the 4 possible screen orientations,
681regardless of what the device will normally do (for example, some devices won't normally use reverse
682portrait or reverse landscape, but this enables those). <em>Added in API level 9.</em></td>
683</tr><tr>
684   <td>"{@code nosensor}"</td>
685   <td>The orientation is determined without reference to a physical orientation sensor.  The sensor
686is ignored, so the display will not rotate based on how the user moves the device.  Except for this
687distinction, the system chooses the orientation using the same policy as for the "{@code
688unspecified}" setting.</td>
689</tr>
690</table>
691
692<p class="note"><strong>Note:</strong> When you declare one of the landscape or portrait values,
693it is considered a hard requirement for the orientation in which the activity runs. As such,
694the value you declare enables filtering by services such as Google Play so your application is
695available only to devices that support the orientation required by your activities. For
696example, if you declare either {@code "landscape"}, {@code "reverseLandscape"}, or
697{@code "sensorLandscape"}, then your application will be available only to devices that support
698landscape orientation. However, you should also explicitly declare that
699your application requires either portrait or landscape orientation with the <a
700href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code &lt;uses-feature&gt;}</a>
701element. For example, <code>&lt;uses-feature
702android:name="android.hardware.screen.portrait"/></code>. This is purely a filtering behavior
703provided by Google Play (and other services that support it) and the platform itself does not
704control whether your app can be installed when a device supports only certain orientations.</p>
705
706</dd>
707
708<dt><a name="state"></a>{@code android:stateNotNeeded}</dt>
709<dd>Whether or not the activity can be killed and successfully restarted 
710without having saved its state &mdash; "{@code true}" if it can be restarted 
711without reference to its previous state, and "{@code false}" if its previous 
712state is required.  The default value is "{@code false}".
713
714<p>
715Normally, before an activity is temporarily shut down to save resources, its 
716<code>{@link android.app.Activity#onSaveInstanceState onSaveInstanceState()}</code> 
717method is called.  This method stores the current state of the activity in a 
718{@link android.os.Bundle} object, which is then passed to 
719<code>{@link android.app.Activity#onCreate onCreate()}</code> when the activity 
720is restarted.  If this attribute is set to "{@code true}", 
721{@code onSaveInstanceState()} may not be called and {@code onCreate()} will 
722be passed {@code null} instead of the Bundle &mdash; just as it was when the 
723activity started for the first time.
724</p>
725
726<p>
727A "{@code true}" setting ensures that the activity can be restarted in the 
728absence of retained state.  For example, the activity that displays the 
729home screen uses this setting to make sure that it does not get removed if it 
730crashes for some reason.
731</p></dd>
732
733<dt><a name="aff"></a>{@code android:taskAffinity}</dt>
734<dd>The task that the activity has an affinity for.  Activities with 
735the same affinity conceptually belong to the same task (to the same
736"application" from the user's perspective).  The affinity of a task 
737is determined by the affinity of its root activity. 
738
739<p>
740The affinity determines two things &mdash; the task that the activity is re-parented 
741to (see the <code><a href="{@docRoot}guide/topics/manifest/activity-element.html#reparent">allowTaskReparenting</a></code> 
742attribute) and the task that will house the activity when it is launched 
743with the <code>{@link android.content.Intent#FLAG_ACTIVITY_NEW_TASK}</code> 
744flag.
745</p>
746
747<p>
748By default, all activities in an application have the same affinity.  You
749can set this attribute to group them differently, and even place
750activities defined in different applications within the same task.  To 
751specify that the activity does not have an affinity for any task, set
752it to an empty string.
753
754<p>
755If this attribute is not set, the activity inherits the affinity set 
756for the application (see the 
757<code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code> 
758element's 
759<code><a href="{@docRoot}guide/topics/manifest/application-element.html#aff">taskAffinity</a></code>
760attribute).  The name of the default affinity for an application is 
761the package name set by the 
762<code><a href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a></code> 
763element.
764</p>
765
766<dt><a name="theme"></a>{@code android:theme}</dt>
767<dd>A reference to a style resource defining an overall theme for the activity.  
768This automatically sets the activity's context to use this theme (see
769<code>{@link android.content.Context#setTheme setTheme()}</code>, and may also 
770cause "starting" animations prior to the activity being launched (to better 
771match what the activity actually looks like).
772
773<p>
774If this attribute is not set, the activity inherits the theme set for the 
775application as a whole &mdash; from the 
776<code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code> 
777element's 
778<code><a href="{@docRoot}guide/topics/manifest/application-element.html#theme">theme</a></code> 
779attribute.  If that attribute is also not set, the default system theme is used. For more
780information, see the <a
781href="{@docRoot}guide/topics/ui/themes.html">Styles and Themes</a> developer guide.
782</p>
783<dd>
784
785<!-- ##api level 14## -->
786<dt><a name="uioptions"></a>{@code android:uiOptions}</dt>
787<dd>Extra options for an activity's UI.
788  <p>Must be one of the following values.</p>
789
790  <table>
791    <tr><th>Value</th><th>Description</th></tr>
792    <tr><td>{@code "none"}</td><td>No extra UI options. This is the default.</td></tr>
793    <tr><td>{@code "splitActionBarWhenNarrow"}</td><td>Add a bar at
794the bottom of the screen to display action items in the {@link android.app.ActionBar}, when
795constrained for horizontal space (such as when in portrait mode on a handset). Instead of a small
796number of action items appearing in the action bar at the top of the screen, the action bar is
797split into the top navigation section and the bottom bar for action items. This ensures a reasonable
798amount of space is made available not only for the action items, but also for navigation and title
799elements at the top. Menu items are not split across the two bars; they always appear
800together.</td></tr>
801  </table>
802  <p>For more information about the action bar, see the <a
803href="{@docRoot}guide/topics/ui/actionbar.html">Action Bar</a> developer guide.</p>
804  <p>This attribute was added in API level 14.</p>
805</dd>
806
807
808<!-- ##api level 3## -->
809<dt><a name="wsoft"></a>{@code android:windowSoftInputMode}</dt>
810<dd>How the main window of the activity interacts with the window containing 
811the on-screen soft keyboard.  The setting for this attribute affects two 
812things: 
813
814<ul> 
815<li>The state of the soft keyboard &mdash; whether it is hidden or visible 
816&mdash; when the activity becomes the focus of user attention.</li>
817
818<li>The adjustment made to the activity's main window &mdash; whether it is 
819resized smaller to make room for the soft keyboard or whether its contents 
820pan to make the current focus visible when part of the window is covered by 
821the soft keyboard.</li>
822</ul>
823
824<p>
825The setting must be one of the values listed in the following table, or a 
826combination of one "{@code state...}" value plus one "{@code adjust...}" 
827value.  Setting multiple values in either group &mdash; multiple 
828"{@code state...}" values, for example &mdash; has undefined results.  
829Individual values are separated by a vertical bar ({@code |}).  For example:
830</p>
831
832<pre>&lt;activity android:windowSoftInputMode="stateVisible|adjustResize" . . . &gt;</pre>
833
834<p>
835Values set here (other than "{@code stateUnspecified}" and 
836"{@code adjustUnspecified}") override values set in the theme.
837</p>
838
839<table>
840<tr>
841   <th>Value</th>
842   <th>Description</th>
843</tr><tr>
844   <td>"{@code stateUnspecified}"</td>
845   <td>The state of the soft keyboard (whether it is hidden or visible) 
846       is not specified.  The system will choose an appropriate state or
847       rely on the setting in the theme.  
848
849       <p>
850       This is the default setting for the behavior of the soft keyboard.
851       </p></td>
852</tr></tr>
853   <td>"{@code stateUnchanged}"</td>
854   <td>The soft keyboard is kept in whatever state it was last in,
855       whether visible or hidden, when the activity comes to the fore.</td>
856</tr></tr>
857   <td>"{@code stateHidden}"</td>
858   <td>The soft keyboard is hidden when the user chooses the activity 
859       &mdash; that is, when the user affirmatively navigates forward to the 
860       activity, rather than backs into it because of leaving another activity.</td>
861</tr></tr>
862   <td>"{@code stateAlwaysHidden}"</td>
863   <td>The soft keyboard is always hidden when the activity's main window 
864       has input focus.</td>
865</tr></tr>
866   <td>"{@code stateVisible}"</td>
867   <td>The soft keyboard is visible when that's normally appropriate 
868       (when the user is navigating forward to the activity's main window).</td>
869</tr></tr>
870   <td>"{@code stateAlwaysVisible}"</td>
871   <td>The soft keyboard is made visible when the user chooses the 
872       activity &mdash; that is, when the user affirmatively navigates forward 
873       to the activity, rather than backs into it because of leaving another 
874       activity.</td>
875</tr></tr>
876   <td>"{@code adjustUnspecified}"</td>
877   <td>It is unspecified whether the activity's main window resizes 
878       to make room for the soft keyboard, or whether the contents 
879       of the window pan to make the currentfocus visible on-screen. 
880       The system will automatically select one of these modes depending
881       on whether the content of the window has any layout views that 
882       can scroll their contents.  If there is such a view, the window 
883       will be resized, on the assumption that scrolling can make all 
884       of the window's contents visible within a smaller area.
885
886       <p>
887       This is the default setting for the behavior of the main window.
888       </p></td>
889</tr></tr>
890   <td>"{@code adjustResize}"</td>
891   <td>The activity's main window is always resized to make room for 
892       the soft keyboard on screen.</td>
893</tr></tr>
894   <td>"{@code adjustPan}"</td>
895   <td>The activity's main window is not resized to make room for the soft
896       keyboard.  Rather, the contents of the window are automatically 
897       panned so that the current focus is never obscured by the keyboard
898       and users can always see what they are typing.  This is generally less 
899       desirable than resizing, because the user may need to close the soft
900       keyboard to get at and interact with obscured parts of the window.</td>
901</tr>
902</table>
903
904<p>
905This attribute was introduced in API Level 3.
906</p></dd>
907</dl></dd>
908
909<!-- ##api level indication## -->
910<dt>introduced in:</dt>
911<dd>API Level 1 for all attributes except for 
912<code><a href="#nohist">noHistory</a></code> and
913<code><a href="#wsoft">windowSoftInputMode</a></code>, which were added in API 
914Level 3.</dd>
915
916<dt>see also:</dt>
917<dd><code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code> 
918<br/><code><a href="{@docRoot}guide/topics/manifest/activity-alias-element.html">&lt;activity-alias&gt;</a></code></dd>
919</dl>
920