O'Reilly logo

Reactive Android Programming by Tadas Subonis

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

Preferences XML

PreferencesFragment will use an XML file to construct the user interface for the settings. We need to create a file, named preferences.xml, under the app/src/main/res/xml directory, which will contain the following code:

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">    <EditTextPreference        android:key="pref_symbols"        android:summary="Stock Symbols to Follow"        android:title="Symbols" />    <EditTextPreference        android:key="pref_keywords"        android:summary="Twitter keywords to monitor"        android:title="Keywords" /></PreferenceScreen>

The following element is responsible for displaying a text field whose value will be written to the key named pref_symbols in the SharedPreferences object:

<EditTextPreference ...

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