5.6.6. Method resetQuiz
Method resetQuiz
(Fig. 5.30) sets up and starts a quiz. Recall that the images for the game are stored in the app’s assets
folder. To access this folder’s contents, the method gets the app’s AssetManager
(line 134) by calling the parent Activity
’s getAssets method. Next, line 135 clears the fileNameList
to prepare to load image file names for only the enabled geographical regions. Lines 140–147 iterate through all the enabled world regions. For each, we use the AssetManager
’s list
method (line 143) to get an array of the flag image file names, which we store in the String
array paths
. Lines 145–146 remove the .png
extension from each file name and place the names in the fileNameList
. Asset-Manager
’s list
method throws ...
Get Android™ How to Program, Second 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.