code: protected void setSummary(Preference pref) {
          SharedPreferences prefs = getPreferenceManager().getSharedPreferences();
          if (pref instanceof RingtonePreference) {
              String val = prefs.getString(pref.getKey(), null);
              if (!TextUtils.isEmpty(val)) {
                  Ringtone tone = RingtoneManager.getRingtone(a, Uri.parse(val));
                  if (tone != null) {
                      pref.setSummary(tone.getTitle(a));
                  }
              } else {
                  pref.setSummary(R.string.none);
              }
          } else if (pref instanceof MultiSelectListPreference) {
              Set<String> vals = prefs.getStringSet(pref.getKey(), null);
              if (vals != null) {
                  if (!vals.isEmpty()) {
                      MultiSelectListPreference multi = (MultiSelectListPreference) pref;
                      ArrayIntList indexList = new ArrayIntList(vals.size());
                      for (String val : vals) { // find selected entry indexes
                          int i = multi.findIndexOfValue(val);
                          if (i >= 0) {
                              indexList.add(i);
                          }
                      }
                      int[] indexes = indexList.toArray();
                      Arrays.sort(indexes); // to display in same order as dialog
                      pref.setSummary(TextUtils.join(getString(R.string.delimiter),
                              Elements.slice(multi.getEntries(), indexes)));
                  } else {
                      pref.setSummary(R.string.none);
                  }
              }
          } else if (pref instanceof EditTextPreference) {
              pref.setSummary(prefs.getString(pref.getKey(), null));
          } else if (pref.getClass().equals(Preference.class)) {
              String val = prefs.getString(pref.getKey(), null);
              if (!TextUtils.isEmpty(val)) { // don't clear existing summary
                  pref.setSummary(val);
              }
          }
      }
docs: Set the preference's value(s) as its summary.