application-element.jd revision 084369fb5e738e4db6ae94b4e24e777bdd9d9c2c
1page.title=<application> 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"><application android:<a href="#reparent">allowTaskReparenting</a>=["true" | "false"] 9 android:<a href="#agent">backupAgent</a>="<i>string</i>" 10 android:<a href="#debug">debuggable</a>=["true" | "false"] 11 android:<a href="#desc">description</a>="<i>string resource</i>" 12 android:<a href="#enabled">enabled</a>=["true" | "false"] 13 android:<a href="#code">hasCode</a>=["true" | "false"] 14 android:<a href="#hwaccel">hardwareAccelerated</a>=["true" | "false"] 15 android:<a href="#icon">icon</a>="<i>drawable resource</i>" 16 android:<a href="#killrst">killAfterRestore</a>=["true" | "false"] 17 android:<a href="#label">label</a>="<i>string resource</i>" 18 android:<a href="#logo">logo</a>="<i>drawable resource</i>" 19 android:<a href="#space">manageSpaceActivity</a>="<i>string</i>" 20 android:<a href="#nm">name</a>="<i>string</i>" 21 android:<a href="#prmsn">permission</a>="<i>string</i>" 22 android:<a href="#persistent">persistent</a>=["true" | "false"] 23 android:<a href="#proc">process</a>="<i>string</i>" 24 android:<a href="#restoreany">restoreAnyVersion</a>=["true" | "false"] 25 android:<a href="#aff">taskAffinity</a>="<i>string</i>" 26 android:<a href="#theme">theme</a>="<i>resource or theme</i>" 27 android:<a href="#uioptions">uiOptions</a>=["none" | "splitActionBarWhenNarrow"] > 28 . . . 29</application></pre></dd> 30 31<dt>contained in:</dt> 32<dd><code><a href="{@docRoot}guide/topics/manifest/manifest-element.html"><manifest></a></code></dd> 33 34<dt>can contain:</dt> 35<dd><code><a href="{@docRoot}guide/topics/manifest/activity-element.html"><activity></a></code> 36<br/><code><a href="{@docRoot}guide/topics/manifest/activity-alias-element.html"><activity-alias></a></code> 37<br/><code><a href="{@docRoot}guide/topics/manifest/service-element.html"><service></a></code> 38<br/><code><a href="{@docRoot}guide/topics/manifest/receiver-element.html"><receiver></a></code> 39<br/><code><a href="{@docRoot}guide/topics/manifest/provider-element.html"><provider></a></code> 40<br/><code><a href="{@docRoot}guide/topics/manifest/uses-library-element.html"><uses-library></a></code></dd> 41 42<dt>description:</dt> 43<dd>The declaration of the application. This element contains subelements 44that declare each of the application's components and has attributes 45that can affect all the components. Many of these attributes (such as 46{@code icon}, {@code label}, {@code permission}, {@code process}, 47{@code taskAffinity}, and {@code allowTaskReparenting}) set default values 48for corresponding attributes of the component elements. Others (such as 49{@code debuggable}, {@code enabled}, {@code description}, and 50{@code allowClearUserData}) set values for the application as a whole and 51cannot be overridden by the components.</dd> 52 53<dt>attributes</dt> 54<dd><dl class="attr"> 55 56<dt><a name="reparent"></a>{@code android:allowTaskReparenting}</dt> 57<dd>Whether or not activities that the application defines can move from 58the task that started them to the task they have an affinity for when that task 59is next brought to the front — "{@code true}" if they can move, and 60"{@code false}" if they must remain with the task where they started. 61The default value is "{@code false}". 62 63<p> 64The 65<code><a href="{@docRoot}guide/topics/manifest/activity-element.html"><activity></a></code> 66element has its own 67<code><a href="{@docRoot}guide/topics/manifest/activity-element.html#reparent">allowTaskReparenting</a></code> 68attribute that can override the value set here. See that attribute for more 69information. 70</p></dd> 71 72<dt><a name="agent"></a>{@code android:backupAgent}</dt> 73<dd>The name of the class that implement's the application's backup agent, 74a subclass of {@link android.app.backup.BackupAgent}. The attribute value should be 75a fully qualified class name (such as, "{@code com.example.project.MyBackupAgent}"). 76However, as a shorthand, if the first character of the name is a period 77(for example, "{@code .MyBackupAgent}"), it is appended to the 78package name specified in the 79<code><a href="{@docRoot}guide/topics/manifest/manifest-element.html"><manifest></a></code> 80element. 81 82<p> 83There is no default. The name must be specified. 84</p></dd> 85 86<dt><a name="debug"></a>{@code android:debuggable}</dt> 87<dd>Whether or not the application can be debugged, even when running 88on a device in user mode — "{@code true}" if it can be, and "{@code false}" 89if not. The default value is "{@code false}".</dd> 90 91<dt><a name="desc"></a>{@code android:description}</dt> 92<dd>User-readable text about the application, longer and more descriptive than the application label. The value must be set as a reference to a string resource. Unlike the label, it cannot be a raw string. There is no default value.</dd> 93 94<dt><a name="enabled"></a>{@code android:enabled}</dt> 95<dd>Whether or not the Android system can instantiate components of 96the application — "{@code true}" if it can, and "{@code false}" 97if not. If the value is "{@code true}", each component's 98{@code enabled} attribute determines whether that component is enabled 99or not. If the value is "{@code false}", it overrides the 100component-specific values; all components are disabled. 101 102<p> 103The default value is "{@code true}". 104</p></dd> 105 106<dt><a name="code"></a>{@code android:hasCode}</dt> 107<dd>Whether or not the application contains any code — "{@code true}" 108if it does, and "{@code false}" if not. When the value is "{@code false}", 109the system does not try to load any application code when launching components. 110The default value is "{@code true}". 111 112<p> 113An application would not have any code of its own only if it's using nothing 114but built-in component classes, such as an activity that uses the {@link 115android.app.AliasActivity} class, a rare occurrence.</p> 116</dd> 117 118<dt><a name="hwaccel"></a>{@code android:hardwareAccelerated}</dt> 119<dd>Whether or not hardware-accelerated rendering should be enabled for all 120Activities and Views in this application — "{@code true}" if it 121should be enabled, and "{@code false}" if not. The default value is "{@code false}". 122 123<p>Starting from Android 3.0, a hardware-accelerated OpenGL renderer is 124available to applications, to improve performance for many common 2D graphics 125operations. When the hardware-accelerated renderer is enabled, most operations 126in Canvas, Paint, Xfermode, ColorFilter, Shader, and Camera are accelerated. 127This results in smoother animations, smoother scrolling, and improved 128responsiveness overall, even for applications that do not explicitly make use 129the framework's OpenGL libraries. </p> 130 131<p>Note that not all of the OpenGL 2D operations are accelerated. If you enable 132the hardware-accelerated renderer, test your application to ensure that it can 133make use of the renderer without errors.</p> 134</dd> 135 136<dt><a name="icon"></a>{@code android:icon}</dt> 137<dd>An icon for the application as whole, and the default icon for 138each of the application's components. See the individual 139{@code icon} attributes for 140<code><a href="{@docRoot}guide/topics/manifest/activity-element.html"><activity></a></code>, 141<code><a href="{@docRoot}guide/topics/manifest/activity-alias-element.html"><activity-alias></a></code>, 142<code><a href="{@docRoot}guide/topics/manifest/service-element.html"><service></a></code>, 143<code><a href="{@docRoot}guide/topics/manifest/receiver-element.html"><receiver></a></code>, and 144<code><a href="{@docRoot}guide/topics/manifest/provider-element.html"><provider></a></code> elements. 145 146<p> 147This attribute must be set as a reference to a drawable resource containing 148the image (for example {@code "@drawable/icon"}). There is no default icon. 149</p></dd> 150 151<dt><a name="killrst"></a>{@code android:killAfterRestore}</dt> 152<dd>Whether the application in question should be terminated after its 153settings have been restored during a full-system restore operation. 154Single-package restore operations will never cause the application to 155be shut down. Full-system restore operations typically only occur once, 156when the phone is first set up. Third-party applications will not normally 157need to use this attribute. 158 159<p>The default is {@code true}, which means that after the application 160has finished processing its data during a full-system restore, it will be 161terminated. 162</p></dd> 163 164<dt><a name="label"></a>{@code android:label}</dt> 165<dd>A user-readable label for the application as a whole, and a default 166label for each of the application's components. See the individual 167{@code label} attributes for 168<code><a href="{@docRoot}guide/topics/manifest/activity-element.html"><activity></a></code>, 169<code><a href="{@docRoot}guide/topics/manifest/activity-alias-element.html"><activity-alias></a></code>, 170<code><a href="{@docRoot}guide/topics/manifest/service-element.html"><service></a></code>, 171<code><a href="{@docRoot}guide/topics/manifest/receiver-element.html"><receiver></a></code>, and 172<code><a href="{@docRoot}guide/topics/manifest/provider-element.html"><provider></a></code> elements. 173 174<p> 175The label should be set as a reference to a string resource, so that 176it can be localized like other strings in the user interface. 177However, as a convenience while you're developing the application, 178it can also be set as a raw string. 179</p></dd> 180 181<dt><a name="logo"></a>{@code android:logo}</dt> 182<dd>A logo for the application as whole, and the default logo for activities. 183<p>This attribute must be set as a reference to a drawable resource containing 184the image (for example {@code "@drawable/logo"}). There is no default logo.</p></dd> 185 186<dt><a name="space"></a>{@code android:manageSpaceActivity}</dt> 187<dd>The fully qualified name of an Activity subclass that the system 188can launch to let users manage the memory occupied by the application 189on the device. The activity should also be declared with an 190<code><a href="{@docRoot}guide/topics/manifest/activity-element.html"><activity></a></code> element. 191</dd> 192 193<dt><a name="nm"></a>{@code android:name}</dt> 194<dd>The fully qualified name of an {@link android.app.Application} 195subclass implemented for the application. When the application process 196is started, this class is instantiated before any of the application's 197components. 198 199<p> 200The subclass is optional; most applications won't need one. 201In the absence of a subclass, Android uses an instance of the base 202Application class. 203</p></dd> 204 205<dt><a name="prmsn"></a>{@code android:permission}</dt> 206<dd>The name of a permission that clients must have in order to interact 207with the application. This attribute is a convenient way to set a 208permission that applies to all of the application's components. It can 209be overwritten by setting the {@code permission} attributes of individual 210components. 211 212<p> 213For more information on permissions, see the 214<a href="{@docRoot}guide/topics/manifest/manifest-intro.html#sectperm">Permissions</a> 215section in the introduction and another document, 216<a href="{@docRoot}guide/topics/security/security.html">Security and 217Permissions</a>. 218</p></dd> 219 220<dt><a name="persistent"></a>{@code android:persistent}</dt> 221<dd>Whether or not the application should remain running at all times — 222"{@code true}" if it should, and "{@code false}" if not. The default value 223is "{@code false}". Applications should not normally set this flag; 224persistence mode is intended only for certain system applications.</dd> 225 226<dt><a name="proc"></a>{@code android:process}</dt> 227<dd>The name of a process where all components of the application should run. 228Each component can override this default by setting its own {@code process} 229attribute. 230 231<p> 232By default, Android creates a process for an application when the first 233of its components needs to run. All components then run in that process. 234The name of the default process matches the package name set by the 235<code><a href="{@docRoot}guide/topics/manifest/manifest-element.html"><manifest></a></code> element. 236</p> 237 238<p>By setting this attribute to a process name that's shared with another 239application, you can arrange for components of both applications to run in 240the same process — but only if the two applications also share a 241user ID and be signed with the same certificate. 242</p> 243 244<p> 245If the name assigned to this attribute begins with a colon (':'), a new 246process, private to the application, is created when it's needed. 247If the process name begins with a lowercase character, a global process 248of that name is created. A global process can be shared with other 249applications, reducing resource usage. 250</p></dd> 251 252<dt><a href name="restoreany"></a>{@code android:restoreAnyVersion}</dt> 253<dd>Indicate that the application is prepared to attempt a restore of any 254backed-up data set, even if the backup was stored by a newer version 255of the application than is currently installed on the device. Setting 256this attribute to {@code true} will permit the Backup Manager to 257attempt restore even when a version mismatch suggests that the data are 258incompatible. <em>Use with caution!</em> 259 260<p>The default value of this attribute is {@code false}. 261</p></dd> 262 263<dt><a href name="aff"></a>{@code android:taskAffinity}</dt> 264<dd>An affinity name that applies to all activities within the application, 265except for those that set a different affinity with their own 266<code><a href="{@docRoot}guide/topics/manifest/activity-element.html#aff">taskAffinity</a></code> 267attributes. See that attribute for more information. 268 269<p> 270By default, all activities within an application share the same 271affinity. The name of that affinity is the same as the package name 272set by the 273<code><a href="{@docRoot}guide/topics/manifest/manifest-element.html"><manifest></a></code> element. 274</p></dd> 275 276<dt><a name="theme"></a>{@code android:theme}</dt> 277<dd>A reference to a style resource defining a default theme for all 278activities in the application. Individual activities can override 279the default by setting their own <code><a href="{@docRoot}guide/topics/manifest/activity-element.html#theme">theme</a></code> 280attributes. For more information, see the <a 281href="{@docRoot}guide/topics/ui/themes.html">Styles and Themes</a> developer guide. 282</dd> 283 284<!-- ##api level 14## --> 285<dt><a name="uioptions"></a>{@code android:uiOptions}</dt> 286<dd>Extra options for an activity's UI. 287 <p>Must be one of the following values.</p> 288 289 <table> 290 <tr><th>Value</th><th>Description</th></tr> 291 <tr><td>{@code "none"}</td><td>No extra UI options. This is the default.</td></tr> 292 <tr><td>{@code "splitActionBarWhenNarrow"}</td><td>Add a bar at 293the bottom of the screen to display action items in the {@link android.app.ActionBar}, when 294constrained for horizontal space (such as when in portrait mode on a handset). Instead of a small 295number of action items appearing in the action bar at the top of the screen, the action bar is 296split into the top navigation section and the bottom bar for action items. This ensures a reasonable 297amount of space is made available not only for the action items, but also for navigation and title 298elements at the top. Menu items are not split across the two bars; they always appear 299together.</td></tr> 300 </table> 301 <p>For more information about the action bar, see the <a 302href="{@docRoot}guide/topics/ui/actionbar.html">Action Bar</a> developer guide.</p> 303 <p>This attribute was added in API level 14.</p> 304</dd> 305 306</dl></dd> 307 308<!-- ##api level indication## --> 309<dt>introduced in:</dt> 310<dd>API Level 1</dd> 311 312<dt>see also:</dt> 313<dd><code><a href="{@docRoot}guide/topics/manifest/activity-element.html"><activity></a></code> 314<br/><code><a href="{@docRoot}guide/topics/manifest/service-element.html"><service></a></code> 315<br/><code><a href="{@docRoot}guide/topics/manifest/receiver-element.html"><receiver></a></code> 316<br/><code><a href="{@docRoot}guide/topics/manifest/provider-element.html"><provider></a></code></dd> 317 318</dl> 319