O'Reilly logo

Android Development Tools for Eclipse by Sanjay Shah, Khirulnizam Abd Rahman

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

Defining the Preference screen

Preferences are an important aspect of the android applications. It allows users to have the choice to modify and personalize it. Preferences can be set two ways: the first method is to create the preferences.xml file in the res/xml directory and the second method is to set the preferences from the code. We will use the former, also the easier one, by creating the preferences.xml file as follows:

Create the xml directory, if it does not exit, and add the preferences.xml file. Every preference needs the following attributes, as shown in the table:

Property

Description

android:key

Used to get the preference value

android:title

To specify the android title

android:summary

Summary about preferences

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