CHAPTER 4: Introduction to XML: Defining an Android App, Its Design, and Constants 129
XML Inflation: How XML Works with Java
Since we are going to get into Java objects, as well as classes and methods and the like, in the next
chapter, I am going to briefly touch upon how all of this parameter-rich XML markup gets turned into
Java-compatible data structures.
These XML definition structures that contain your parent and child tags as well as any parameters
need to get transformed from XML-compatible data structures into Java-compatible data structures.
This is accomplished by the Android OS using a process called “inflation,” which you invoke using
the .inflate( ) or findViewById() method in your Java programming logic.
The Java-compatible data structures that are created from your XML definitions via this inflation
process are known as “objects,” and you will learn all about what Java objects are, and what they
are utilized for, in the next chapter, which covers the Java programming language.
Think of an empty Java object structure as a limp balloon, and your XML definition as the air that
will inflate it! What Android does, more accurately, is to take your XML definition and create a Java
object of the appropriate type using your definition; that is, by using the XML tags and parameters
you defined in your XML file.
For instance, for a