preference

Custom views in a PreferenceActivity

SDK Version: 
M3

Let's take another look at PreferenceAcitivites, and how we can use other views, than the basic PreferenceActivity views.

PreferenceActivity with custom functionality

SDK Version: 
M3

As we previously desribed in PreferenceActivity Basics a preferences screen with basic features can be done with minimal work, only using XML. Now we will inplement some functionality beyond the base ones, this will require some coding in addition to the XML definition.

We will display the actual value in each preferences summary field, like this:

The base XML will be the same as in the previous example, but we dont need to fill summary fields, they will be filled dinamically.

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
  3.         android:title="Settings">
  4.         <EditTextPreference android:title="Name"
  5.                 android:inputType="text"

Syndicate content