Setting Up a Second Activity
There is a lot to do in this chapter. Fortunately, some of the grunt work can be done for you by Android Studio’s New Android Activity wizard.
Before you invoke the magic, open res/values/strings.xml and add all the strings you will need for this chapter.
Listing 7.1 Adding strings (res/values/strings.xml
)
<resources> ... <string name="incorrect_toast">Incorrect!</string> <string name="warning_text">Are you sure you want to do this?</string> <string name="show_answer_button">Show Answer</string> <string name="cheat_button">Cheat!</string> <string name="judgment_toast">Cheating is wrong.</string> </resources>
Creating a new activity
Creating an activity typically involves touching at least ...
Get Android Programming: The Big Nerd Ranch Guide, 5th 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.