Class 관계를 살펴보면 PreferenceActivity는 ListActivity를 상속받는다.
<ListView android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:drawSelectorOnTop="false"/>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/settings">
<CheckBoxPreference
android:key="alarm_in_silent_mode"
android:title="@string/alarm_in_silent_mode_title"
android:summary="@string/alarm_in_silent_mode_summary" />
<VolumePreference
android:title="@string/alarm_volume_title"
android:summary="@string/alarm_volume_summary"
android:dialogTitle="@string/alarm_volume_title"
android:persistent="false"
android:streamType="alarm" />
<ListPreference
android:key="snooze_duration"
android:title="@string/snooze_duration_title"
android:entries="@array/snooze_duration_entries"
android:entryValues="@array/snooze_duration_values"
android:defaultValue="10"
android:dialogTitle="@string/snooze_duration_title" />
<ListPreference
android:key="volume_button_setting"
android:title="@string/volume_button_setting_title"
android:dialogTitle="@string/volume_button_dialog_title"
android:entries="@array/volume_button_setting_entries"
android:entryValues="@array/volume_button_setting_values"
android:summary="@string/volume_button_setting_summary"
android:defaultValue="2" />
</PreferenceScreen>
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.settings); } @Override public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { if (KEY_ALARM_IN_SILENT_MODE.equals(preference.getKey())) { CheckBoxPreference pref = (CheckBoxPreference) preference; int ringerModeStreamTypes = Settings.System.getInt( getContentResolver(), Settings.System.MODE_RINGER_STREAMS_AFFECTED, 0); if (pref.isChecked()) { ringerModeStreamTypes &= ~ALARM_STREAM_TYPE_BIT; } else { ringerModeStreamTypes |= ALARM_STREAM_TYPE_BIT; } Settings.System.putInt(getContentResolver(), Settings.System.MODE_RINGER_STREAMS_AFFECTED, ringerModeStreamTypes); return true; } return super.onPreferenceTreeClick(preferenceScreen, preference); } public boolean onPreferenceChange(Preference pref, Object newValue) { final ListPreference listPref = (ListPreference) pref; final int idx = listPref.findIndexOfValue((String) newValue); listPref.setSummary(listPref.getEntries()[idx]); return true; }