Updating the View Layer
Now that you have been introduced to MVC, you are going to 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_main.xml. This layout needs to be updated as shown in Figure 2.5. (Note that to save space we are not showing the attributes of unchanged widgets.)
Figure 2.5 New button!
So the changes you need to make to the view layer are:
-
Give the TextView an
android:id
attribute. This widget will need a resource ID so that you can set its text in MainActivity ...
Get Android Programming: The Big Nerd Ranch Guide, 4th Edition 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.