O'Reilly logo

Android Application Development For Dummies, 2nd Edition by Donn Felker, Michael Burton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Understanding the Android Preferences Framework

One outstanding quality of the Android preferences framework is the simplicity of developing a screen that allows users to modify their preferences. Most of the heavy lifting is done for you by Android because developing a preferences screen is as simple as defining it in the XML located in the res/xml folder of your project. Though these XML files aren’t the same as layout files, there are specific XML definitions that define screens, categories, and actual preferences. Common preferences that are built into the framework include

check.png EditTextPreference: Stores plain text as a string

check.png CheckBoxPreference: Stores a Boolean value

check.png RingtonePreference: Allows the user to store a preferred ringtone from those available on the device

check.png ListPreference: Allows the user to select a preferred item from a list of items in the dialog box

If the built-in preferences don’t suit your needs, you can create your own preference by deriving it from the base Preference class or DialogPreference. A DialogPreference is the base class for preferences that are dialog-box-based. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required