Java Reference
In-Depth Information
package="ca.tutortutor.simpleapp">
<application
android:label="@string/app_name"
an-
droid:icon="@drawable/icon">
<activity
android:name=".simpleactivity"
an-
droid:label="@string/app_name">
<intent-filter>
<action
an-
droid:name="android.intent.action.main" />
<category
an-
droid:name="android.intent.category.launcher" />
</intent-filter>
</activity>
<!-- ... -->
</application>
</manifest>
Listing12-2 beginswiththe <?xml version="1.0" encoding="utf-8"?>
prolog,whichidentifies thisfile asanXMLversion1.0file whosecontent isencoded
according to the UTF-8 encoding standard. ( Chapter 10 introduces you to XML.)
Listing 12-2 next presents the manifest element, which is this XML document's
root element: android identifies the Android namespace, and package identifies
the app's Java package—each app must have its own Java package, which is
ca.tutortutor.simpleapp in this example. Additional attributes can be spe-
cified. For example, you can specify versionCode and versionName attributes
when you want to identify version information.
Nestedwithin manifest is application ,whichistheparentofappcomponent
elements. Its label and icon attributes refer to label and icon application resources
thatAndroiddevicesdisplaytorepresenttheapp,andwhichserveasdefaultsforindi-
vidual components whose start tags don't specify these attributes. (I'll discuss applica-
tion resources shortly.)
Note Application resources are identified by the @ prefix, followed by a category
name (e.g., string or drawable ), / , and the application resource ID (e.g.,
app_name or icon ).
Nested within application is an activity element that describes an activity
component. The name attribute identifies a class ( SimpleActivity ) that imple-
Search WWH ::




Custom Search