code: private static void bindPreferenceSummaryToValue(Preference preference) {
          // Set the listener to watch for value changes.
          preference.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener);
  
          // Trigger the listener immediately with the preference's
          // current value.
          if (preference instanceof CheckBoxPreference) {
              sBindPreferenceSummaryToValueListener.onPreferenceChange(preference,
                      PreferenceManager
                              .getDefaultSharedPreferences(preference.getContext())
                              .getBoolean(preference.getKey(), true));
          }
          else{
              sBindPreferenceSummaryToValueListener.onPreferenceChange(preference,
                      PreferenceManager
                              .getDefaultSharedPreferences(preference.getContext())
                              .getString(preference.getKey(), ""));
          }
      }
docs: Binds a preference's summary to its value. More specifically, when the
  preference's value is changed, its summary (line of text below the
  preference title) is updated to reflect the value. The summary is also
  immediately updated upon calling this method. The exact display format is
  dependent on the type of preference.
  
  @see #sBindPreferenceSummaryToValueListener