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