5.6.5. Method updateRegions

Method updateRegions (Fig. 5.29) is called from the app’s MainActivity when the app is launched and each time the user changes the world regions that should be included in the quiz. Lines 126–127 use the method’s SharedPreferences argument to get the names of all of the enabled regions as a Set<String>. MainActivity.REGIONS is a constant containing the name of the preference in which the SettingsFragment stores the enabled world regions.

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.