package app.com.example.android.popularmovies;


import android.os.Bundle;
import android.preference.PreferenceFragment;

public class SettingsFragment extends PreferenceFragment {


    public SettingsFragment() {
        // Required empty public constructor
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        //Load the preferences from a XML resource
        addPreferencesFromResource(R.xml.preferences);
    }
}

@@ -94,34 +94,159 @@
 ference.
-PreferenceFragment
+ListPreference;%0Aimport android.preference.Preference;%0Aimport android.preference.PreferenceFragment;%0Aimport android.preference.PreferenceManager
 ;%0A%0Apubli
@@ -297,16 +297,65 @@
 ragment 
+implements Preference.OnPreferenceChangeListener 
 %7B%0A%0A%0A    
@@ -652,16 +652,1319 @@
 rences);
+%0A%0A        bindPreferenceSummaryToValue(findPreference(getString(R.string.preferences_search_type_key)));%0A    %7D%0A%0A    /**%0A     *Attaches a listener so the summary is always updated with the preference value.%0A     *Also fires the listener once, to initialize the summary (so it shows up before the value%0A     *is changed.)%0A     */%0A    private void bindPreferenceSummaryToValue(Preference preference) %7B%0A        // Set the listener to watch for value changes.%0A        preference.setOnPreferenceChangeListener(this);%0A%0A        // Trigger the listener immediately with the preference's%0A        // current value.%0A        onPreferenceChange(preference,%0A                PreferenceManager%0A                        .getDefaultSharedPreferences(preference.getContext())%0A                        .getString(preference.getKey(), %22%22));%0A    %7D%0A%0A    @Override%0A    public boolean onPreferenceChange(Preference preference, Object value) %7B%0A        String stringValue = value.toString();%0A%0A        if(preference instanceof ListPreference)%7B%0A            ListPreference listPreference = (ListPreference) preference;%0A            int index = listPreference.findIndexOfValue(stringValue);%0A            if(index %3E= 0)%7B%0A                preference.setSummary(listPreference.getEntries()%5Bindex%5D);%0A            %7D%0A        %7D%0A        return true;
 %0A    %7D%0A%7D

Change SettingsFragment to display the chosen setting