A (175)

(Tuis.) #1
CHAPTER 4: Introduction to XML: Defining an Android App, Its Design, and Constants 123

XML Manifest: Configuring the Android Manifest


Let’s open the Android Manifest in Eclipse’s central editing pane by right-clicking the AndroidManifest.
xml file and selecting the Open menu option (or left-clicking this file and using the F3 function key).
As you can see in Figure 4 -1 7 , the AndroidManifest XML markup is already nested several levels
deep, and starts with the parent tag, as would be expected, and contains two child tags.


Figure 4-17. Viewing the HelloUniverse Manifest in the Eclipse central edit pane using the AndroidManifest.xml bottom tab


The child tags describe the as well as what SDK versions are being used for your
application, via the child tag, which as you can see includes two parameters, for
your android:minSdkVersion and android:targetSdkVersion, which you set back in Chapter 3
(Figure 3-3) at API Level 8 and 19, respectively.


The XML construct or structure is more complicated, as expected, and references the
icon that you created back in Chapter 3 as well as the app_name string constant and AppTheme
style constant. There is also an android:allowBackup switch (Boolean) that is set to “on,” which is
indicated by a “true” value.


Nested under your child tag is the child tag, so in a sense, the tag
has grandchildren, although Android does not use the terminology grandchild tag or great-grandchild
tag. The tag has an android:name parameter that references your MainActivity.java file
in your package, which is named absolute.beginner.hellouniverse, so the complete path to the
MainActivity.java Activity class would be absolute.beginner.hellouniverse.MainActivity and would be
referenced using the following parameter:


android:name="absolute.beginner.hellouniverse.MainActivity"

Free download pdf