Updating the View Layer

Now that you have been introduced to MVC, let’s update GeoQuiz’s view layer to include a Next button.

In Android, objects in the view layer are typically inflated from XML within a layout file. The sole layout in GeoQuiz is defined in activity_quiz.xml. This layout needs updating as shown in Figure 2.6. (Note that we are not showing the attributes of unchanged widgets to save space.)

Figure 2.6  New button!

New button!

So the changes you need to make to the view layer are

  • remove the android:text attribute from the TextView. You no longer want a hard-coded question to be part of its definition.

  • Give the TextView an android:id attribute. ...

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.