This app’s flag images1 are loaded into the app only when needed and are located in the app’s assets folder. To add the images to the project, we dragged each region’s folder from our file system onto the assets
folder in the Package Explorer. The images are located in the images/FlagQuizImages
folder with the book’s examples.
1. We obtained the images from www.free-country-flags.com
.
Unlike an app’s drawable
folders, which require their image contents to be at the root level in each folder, the assets
folder may contain files of any type and they can be organized in subfolders—we maintain the flag images for each region in a separate subfolder. Files in the assets
subfolders are accessed via an AssetManager (package android.content.res
), which can provide a list of all of the file names in a specified subfolder and can be used to access each asset.