4.9 SettingsActivityFragment
Class
Class SettingsActivityFragment
(Fig. 4.44) inherits from PreferenceFragment
(package android.preference
). When the SettingsActivityFragment
is created, method onCreate
(lines 10–14) builds the preferences GUI by calling inherited PreferenceFragment
method addPreferencesFromResource
to build the preferences GUI from the preferences.xml
(Section 4.4.11). As the user interacts with the preferences GUI, the preferences are automatically stored into a SharedPreferences
file on the device. If the file does not exist, it will be created; otherwise, it will be updated. We removed the other unused autogenerated code from this class.
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.