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