4.1 Introduction

The Flag Quiz app tests your ability to correctly identify 10 flags from various countries and territories (Fig. 4.1). By default, the app presents a flag image and four country-name Buttons that you click to guess the answer—one is correct and the others are randomly selected, nonduplicated incorrect answers. The app displays the user’s progress throughout the quiz, showing the question number (out of 10) in a TextView above the current flag image.

Fig. 4.1 Flag Quiz app running on a smartphone in portrait orientation

A flag quiz app window in portrait orientation.

As you’ll see, the app also allows you to control the quiz difficulty by specifying ...

Get Android How to Program, 3/e 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.