5.6.7. Method loadNextFlag
Method loadNextFlag (Fig. 5.31) loads and displays the next flag and the corresponding set of answer Buttons. The image file names in quizCountriesList have the format
regionName-countryName
without the .png extension. If a regionName or countryName contains multiple words, they’re separated by underscores (_).
Line 184 removes the first name from quizCountriesList and stores it in nextImage. We also save this in correctAnswer so it can be used later to determine whether the user made a correct guess. Next, we clear the answerTextView and display the current question number in the questionNumberTextView (lines 189–191) using the formatted String resource R.string.question.
Line 194 extracts from nextImage the region ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access