If you’re using the Preferences API in Android, and want to confirm (show a dialog, perform a test, etc) before a Preference is updated, you need to find that Preference item and call setOnPreferenceChangeListener to a custom listener. This can work in conjunction with PreferenceManager.registerOnSharedPreferenceChangeListener, you just need to return `false` to have the Preference _not_ update…

private Preference.OnPreferenceChangeListener mPreferenceChangeListener = new Preference.OnPreferenceChangeListener() {
  public boolean onPreferenceChange(Preference preference, Object newValue) {
    // newValue will be the _intended_ value, even if it doesn't show up in the UI
    if(someTest) {
      // return false, you need to update it yourself
      return false;
    // return true, the UI will update and the shared prefs file will be written to
    return true;