From Layout XML to View Objects
How do XML elements in activity_quiz.xml become View objects? The answer starts in the QuizActivity class.
When you created the GeoQuiz project, a subclass of Activity named QuizActivity was created for you. The class file for QuizActivity is in the src directory of your project. The src directory is where the Java code for your project lives.
In the package explorer, reveal the contents of the src directory and then the contents of the com.bignerdranch.android.geoquiz package. Open the QuizActivity.java file and take a look at its contents (Listing 1.4).
Listing 1.4 Default class file for QuizActivity
(QuizActivity.java
)
package com.bignerdranch.android.geoquiz; import android.app.Activity; import android.os.Bundle; ...
Get Android Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.