CHAPTER 6: Android Screen Design: Writing to the Display Using Activity and View 169
Inside of a ViewGroup UI layout container parent tag are child tags representing UI elements, which
are called “widgets” in Android. UI widgets are based on Android’s View superclass. Each widget,
like that
widget class, which is subclassed from the View superclass. Inside each (View subclass) UI widget
child tag, you can set parameters that reference the new media assets for your application, such
as drawables (images and bitmap animation), animation (procedural, tween, or vector animation),
audio, video, shapes, custom UI elements, and the like.
Thus, getting your new media assets onto the Android device display screen involves putting
parameters in child widget tags inside of parent UI layout tags referenced by Activity subclass
methods declared in your application’s AndroidManifest XML file. This is all passed over to the
Android RunTime engine, which then converts these into machine language, and then passes them
over to the Linux Kernel, whose job it is to interface the software with the hardware and thus to write
your application UI design and content to the Android device display screen hardware with pixel-perfect
accuracy. Whew! The chain from Android Runtime to app resources looks like this:
Android RunTime > Android Manifest > Activity Subclass > ViewGroup Parent Tag > View Child Tag >
Resource Parameters
To make it even easier to visualize, I created a diagram shown in Figure 6-1 that shows layers
(and connections) between your application’s new media resources, the UI widgets that hold them,
UI layouts that hold the UI widgets, and the Activity subclass that defines and controls your UI layout
XML definition, by referencing it using the .setContentView( ) method call. It is important to note that
since you can set the background image, or animation, for the UI layout container, a ViewGroup can
also reference new media resources; thus, the new media resource area of the diagram in Figure 6-1
makes contact with both the View and ViewGroup subclasses.
Figure 6-1. The stratification of an Android application from new media resources up to an Android device screen
As you learned in the previous chapters, your Android Manifest serves to define for the ART
what Activity classes an application contains, as well as what your application is allowed to do,
and other information about your application’s version history, support, structure, permissions,
communications, intents, and the like.