By : Ketan Bhimani
292
preference name as a variable (in a base class or header) so that
you can reuse the name across multiple activities. For example
public static final String PREFERENCE_FILENAME = “AppPrefs”;
Searching and Reading Preferences
Reading preferences is straightforward. Simply retrieve the
SharedPreferences instance you want to read. You can check for a
preference by name, retrieve strongly typed preferences, and
register to listen for changes to the preferences. Table describes
some helpful methods in the SharedPreferences interface.
Important android.content.SharedPreferences Methods
Adding, Updating, and Deleting Preferences
To change preferences, you need to open the preference Editor,
make your changes, and commit them. Table describes some
helpful methods in the Shared Preferences. Editor interface.