application-element.jd revision 9066cfe9886ac131c34d59ed0e2d287b0e3c0087
1page.title=<application>
2@jd:body
3
4<dl class="xml">
5<dt>syntax:</dt>
6<dd><pre class="stx">&lt;application android:<a href="#clear">allowClearUserData</a>=["true" | "false"]
7             android:<a href="#reparent">allowTaskReparenting</a>=["true" | "false"]
8             android:<a href="#debug">debuggable</a>=["true" | "false"]
9             android:<a href="#desc">description</a>="<i>string resource</i>"
10             android:<a href="#enabled">enabled</a>=["true" | "false"]
11             android:<a href="#code">hasCode</a>=["true" | "false"]
12             android:<a href="#icon">icon</a>="<i>drawable resource</i>"
13             android:<a href="#label">label</a>="<i>string resource</i>"
14             android:<a href="#space">manageSpaceActivity</a>="<i>string</i>"
15             android:<a href="#nm">name</a>="<i>string</i>"
16             android:<a href="#prmsn">permission</a>="<i>string</i>"
17             android:<a href="#persistent">persistent</a>=["true" | "false"]
18             android:<a href="#proc">process</a>="<i>string</i>"
19             android:<a href="#aff">taskAffinity</a>="<i>string</i>"
20             android:<a href="#theme">theme</a>="<i>resource or theme</i>" &gt;
21    . . .
22&lt;/application&gt;</pre></dd>
23
24<dt>contained in:</dt>
25<dd><code><a href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a></code></dd>
26
27<dt>can contain:</dt>
28<dd><code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code>
29<br/><code><a href="{@docRoot}guide/topics/manifest/activity-alias-element.html">&lt;activity-alias&gt;</a></code>
30<br/><code><a href="{@docRoot}guide/topics/manifest/service-element.html">&lt;service&gt;</a></code>
31<br/><code><a href="{@docRoot}guide/topics/manifest/receiver-element.html">&lt;receiver&gt;</a></code>
32<br/><code><a href="{@docRoot}guide/topics/manifest/provider-element.html">&lt;provider&gt;</a></code>
33<br/><code><a href="{@docRoot}guide/topics/manifest/uses-library-element.html">&lt;uses-library&gt;</a></code></dd>
34
35<dt>description:</dt>
36<dd>The declaration of the application.  This element contains subelements 
37that declare each of the application's components and has attributes 
38that can affect all the components.  Many of these attributes (such as 
39{@code icon}, {@code label}, {@code permission}, {@code process}, 
40{@code taskAffinity}, and {@code allowTaskReparenting}) set default values 
41for corresponding attributes of the component elements.  Others (such as
42{@code debuggable}, {@code enabled}, {@code description}, and 
43{@code allowClearUserData})  set values for the application as a whole and 
44cannot be overridden by the components.</dd>
45
46<dt>attributes</dt>
47<dd><dl class="attr">
48<dt><a name="clear"></a>{@code android:allowClearUserData}</dt>
49<dd>Whether or not users are given the option to remove user data &mdash; 
50"{@code true}" if they are, and "{@code false}" if not.  If the value is 
51"{@code true}", as it is by default, the application manager includes an 
52option that allows users to clear the data.</dd>
53
54<dt><a name="reparent"></a>{@code android:allowTaskReparenting}</dt>
55<dd>Whether or not activities that the application defines can move from 
56the task that started them to the task they have an affinity for when that task 
57is next brought to the front &mdash; "{@code true}" if they can move, and 
58"{@code false}" if they must remain with the task where they started.  
59The default value is "{@code false}".
60
61<p>
62The 
63<code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code> 
64element has its own 
65<code><a href="{@docRoot}guide/topics/manifest/activity-element.html#reparent">allowTaskReparenting</a></code>
66attribute that can override the value set here.  See that attribute for more 
67information.
68</p></dd>
69
70<dt><a name="debug"></a>{@code android:debuggable}</dt>
71<dd>Whether or not the application can be debugged, even when running 
72on a device in user mode &mdash; "{@code true}" if it can be, and "{@code false}"
73if not.  The default value is "{@code false}".</dd> 
74
75<dt><a name="desc"></a>{@code android:description}</dt>
76<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>
77
78<dt><a name="enabled"></a>{@code android:enabled}</dt>
79<dd>Whether or not the Android system can instantiate components of 
80the application &mdash; "{@code true}" if it can, and "{@code false}" 
81if not.  If the value is "{@code true}", each component's 
82{@code enabled} attribute determines whether that component is enabled 
83or not.  If the value is "{@code false}", it overrides the 
84component-specific values; all components are disabled.
85
86<p>
87The default value is "{@code true}".
88</p></dd>  
89
90<dt><a name="code"></a>{@code android:hasCode}</dt>
91<dd>Whether or not the application contains any code &mdash; "{@code true}" 
92if it does, and "{@code false}" if not.  When the value is "{@code false}", 
93the system does not try to load any application code when launching components.  
94The default value is "{@code true}".
95
96<p>
97An application would not have any code of its own only if it's using nothing
98but built-in component classes, such as an activity that uses the {@link 
99android.app.AliasActivity} class, a rare occurrence.
100
101<dt><a name="icon"></a>{@code android:icon}</dt>
102<dd>An icon for the application as whole, and the default icon for 
103each of the application's components.  See the individual 
104{@code icon} attributes for 
105<code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code>, 
106<code><a href="{@docRoot}guide/topics/manifest/activity-alias-element.html">&lt;activity-alias&gt;</a></code>,
107<code><a href="{@docRoot}guide/topics/manifest/service-element.html">&lt;service&gt;</a></code>, 
108<code><a href="{@docRoot}guide/topics/manifest/receiver-element.html">&lt;receiver&gt;</a></code>, and
109<code><a href="{@docRoot}guide/topics/manifest/provider-element.html">&lt;provider&gt;</a></code> elements.
110
111<p>
112This attribute must be set as a reference to a drawable resource containing
113the image definition.   There is no default icon.
114</p></dd>
115
116<dt><a name="label"></a>{@code android:label}</dt>
117<dd>A user-readable label for the application as a whole, and a default 
118label for each of the application's components.  See the individual 
119{@code label} attributes for 
120<code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code>, 
121<code><a href="{@docRoot}guide/topics/manifest/activity-alias-element.html">&lt;activity-alias&gt;</a></code>,
122<code><a href="{@docRoot}guide/topics/manifest/service-element.html">&lt;service&gt;</a></code>, 
123<code><a href="{@docRoot}guide/topics/manifest/receiver-element.html">&lt;receiver&gt;</a></code>, and
124<code><a href="{@docRoot}guide/topics/manifest/provider-element.html">&lt;provider&gt;</a></code> elements.
125
126<p>
127The label should be set as a reference to a string resource, so that
128it can be localized like other strings in the user interface.  
129However, as a convenience while you're developing the application, 
130it can also be set as a raw string.
131</p></dd>
132
133<dt><a name="space"></a>{@code android:manageSpaceActivity}</dt>
134<dd>The fully qualified name of an Activity subclass that the system 
135can launch to let users manage the memory occupied by the application 
136on the device.  The activity should also be declared with an 
137<code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code> element.
138</dd>
139
140<dt><a name="nm"></a>{@code android:name}</dt>
141<dd>The fully qualified name of an {@link android.app.Application} 
142subclass implemented for the application.  When the application process 
143is started, this class is instantiated before any of the application's 
144components.  
145
146<p>
147The subclass is optional; most applications won't need one.
148In the absence of a subclass, Android uses an instance of the base 
149Application class.
150</p></dd>
151
152<dt><a name="prmsn"></a>{@code android:permission}</dt>
153<dd>The name of a permission that clients must have in order to interact 
154with the application.  This attribute is a convenient way to set a 
155permission that applies to all of the application's components.  It can 
156be overwritten by setting the {@code permission} attributes of individual 
157components.
158
159<p>
160For more information on permissions, see the 
161<a href="{@docRoot}guide/topics/manifest/manifest-intro.html#sectperm">Permissions</a> 
162section in the introduction and another document, 
163<a href="{@docRoot}guide/topics/security/security.html">Security and
164Permissions</a>.
165</p></dd>
166
167<dt><a name="persistent"></a>{@code android:persistent}</dt>
168<dd>Whether or not the application should remain running at all times &mdash; 
169"{@code true}" if it should, and "{@code false}" if not.  The default value 
170is "{@code false}".  Applications should not normally set this flag; 
171persistence mode is intended only for certain system applications.</dd>
172
173<dt><a name="proc"></a>{@code android:process}</dt>
174<dd>The name of a process where all components of the application should run.
175Each component can override this default by setting its own {@code process}
176attribute.
177
178<p>
179By default, Android creates a process for an application when the first
180of its components needs to run.  All components then run in that process.
181The name of the default process matches the package name set by the
182<code><a href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a></code> element.
183</p>
184
185<p>By setting this attribute to a process name that's shared with another
186application, you can arrange for components of both applications to run in
187the same process &mdash; but only if the two applications also share a
188user ID and be signed with the same certificate.
189</p>
190
191<p>
192If the name assigned to this attribute begins with a colon (':'), a new 
193process, private to the application, is created when it's needed.
194If the process name begins with a lowercase character, a global process 
195of that name is created.  A global process can be shared with other
196applications, reducing resource usage.
197</p></dd>
198
199<dt><a href name="aff"></a>{@code android:taskAffinity}</dt>
200<dd>An affinity name that applies to all activities within the application,
201except for those that set a different affinity with their own
202<code><a href="{@docRoot}guide/topics/manifest/activity-element.html#aff">taskAffinity</a></code> 
203attributes.  See that attribute for more information.
204
205<p>
206By default, all activities within an application share the same 
207affinity.  The name of that affinity is the same as the package name 
208set by the 
209<code><a href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a></code> element.
210</p></dd>
211
212<dt><a name="theme"></a>{@code android:theme}</dt>
213<dd>A reference to a style resource defining a default theme for all
214activities in the application.  Individual activities can override
215the default by setting their own <code><a href="{@docRoot}guide/topics/manifest/activity-element.html#theme">theme</a></code> 
216attributes; see that attribute for more information.</dd>
217
218</dl></dd>
219
220<dt>see also:</dt>
221<dd><code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code>
222<br/><code><a href="{@docRoot}guide/topics/manifest/service-element.html">&lt;service&gt;</a></code>
223<br/><code><a href="{@docRoot}guide/topics/manifest/receiver-element.html">&lt;receiver&gt;</a></code>
224<br/><code><a href="{@docRoot}guide/topics/manifest/provider-element.html">&lt;provider&gt;</a></code></dd>
225
226</dl>
227