標籤:Reading PreferencesBy default, all your app‘s preferences are saved to a file that‘s accessible from anywhere within your application by calling the static method PreferenceManager.getDefaultSharedPreferences(). This returns
標籤:Using Preference HeadersIn rare cases, you might want to design your settings such that the first screen displays only a list of subscreens(such as in the system Settings app, as shown in figures 4 and 5). When you‘re developing such a
標籤:Setting Default ValuesThe preferences you create probably define some important behaviors for your application, so it‘s necessary that you initialize the associated SharedPreferences file with default values for
標籤:OverviewInstead of using View objects to build the user interface, settings are built using various subclasses of thePreference class that you declare in an XML file.A Preference object is the building block for a single
標籤:Creating a Preference ActivityTo display your settings in an activity, extend the PreferenceActivity class. This is an extension of the traditional Activity class that displays a list of settings based on a hierarchy
標籤:Defining Preferences in XML Although you can instantiate new Preference objects at runtime, you should define your list of settings in XML with a hierarchy of Preference objects. Using an XML file to define your collection of