Question: I'm using the `PreferenceFragmentCompat` and I'm not able to find a method to override when a value (in my case from a `ListPreference`) is edited. I just want to react to a chosen value immediately.

Thanks for help!

Answer: 
I found another way to subscribe to all changes of all preferences: [SharedPreferences.OnSharedPreferencesChangeListener](http://developer.android.com/reference/android/content/SharedPreferences.OnSharedPreferenceChangeListener.html). The code with the two alternatives looks like this:

```
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceFragmentCompat;
import android.util.Log;

/**
 * A simple {@link Fragment} subclass.
 */
public class SettingsFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener, Preference.OnPreferenceChangeListener {

    private static final String TAG = "SettingsFragment";

    private Preference thePreference;

    public SettingsFragment() {
    }

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

        addPreferencesFromResource(R.xml.pref);

        thePreference = findPreference("chosen_theme");

        if (thePreference != null) {
            thePreference.setOnPreferenceChangeListener(this);
        } else {
            Log.d(TAG, "Preference is empty");
        }
    }

    @Override
    public void onCreatePreferences(Bundle bundle, String s) {

    }

    @Override
    public boolean onPreferenceChange(Preference preference, Object o) {

        Log.d(TAG, String.format("Changed: %s", preference.getKey()));

        return true;
    }

    @Override
    public void onResume() {
        super.onResume();

        getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
    }

    @Override
    public void onPause() {
        super.onPause();

        getPreferenceScreen().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);
    }

    @Override
    public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {

        Log.d(TAG, String.format("%s %s", sharedPreferences, key));
    }
}

```

The SharedPreferences is faster the Preference is more flexible.
I believe you are looking for the Interface definition for a callback to be invoked when a Preference is clicked:

[Preference.OnPreferenceClickListener](http://developer.android.com/reference/android/support/v7/preference/Preference.OnPreferenceClickListener.html)
======================================================================================================================================================