title: Display the value of the EditTextPreference in summary
body: <p>I'm a learning how to develop in Android and want to make a setting activity, </p>
  
  <p>My setting activity </p>
  
  <pre><code>public class Main extends Activity  {
  
  
      protected SettingsFragment settingsFragment;
  
  
      @SuppressLint("NewApi")
      @TargetApi(11)
      public class SettingsFragment extends PreferenceFragment implements
              SharedPreferences.OnSharedPreferenceChangeListener {
  
  
          @Override
          public void onCreate(Bundle savedInstanceState) {
  
              super.onCreate(savedInstanceState);
              addPreferencesFromResource(R.xml.preferences);
              setSummaries();
  
  
          }
  
  
          @Override
          public void onResume() {
              final SharedPreferences sh = getPreferenceManager().getSharedPreferences() ;
              super.onResume();
              sh.registerOnSharedPreferenceChangeListener(this);
  
          }
  
          @Override
          public void onPause() {
              final SharedPreferences sh = getPreferenceManager().getSharedPreferences() ;
              super.onPause();
              sh.unregisterOnSharedPreferenceChangeListener(this);
          }
  
          @SuppressLint("NewApi")
          public void setSummaries(){
  
             final SharedPreferences sh = getPreferenceManager().getSharedPreferences() ;
  
  
              //Pref1
              Preference stylePref = findPreference("editTextPref");
              stylePref.setSummary(sh.getString("editTextPref", ""));
  
              //here the other preferences..
          }
  
  
          @Override
          public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
              if (key.equals("editTextPref")) {
                  Preference pref = settingsFragment.findPreference(key);
                  // Set summary to be the user-description for the selected value
                  pref.setSummary(sharedPreferences.getString(key, ""));
  
              }
              //here the others preferences
          }
      }//End fragment
  
      @SuppressLint("NewApi")
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          settingsFragment = new SettingsFragment();
          getFragmentManager().beginTransaction()
                  .replace(android.R.id.content, settingsFragment)
                  .commit();
  
  
      }
  
  
  }
  </code></pre>
  
  <p>and my <code>res/preferences.xml</code> file </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;PreferenceCategory
          android:title="BTA"
          xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  
  
          &lt;EditTextPreference
              android:key="editTextPref"
              android:title="Numero de telephone"
              android:summary="This allows you to enter a string"
              android:defaultValue="*"/&gt;
  
      &lt;/PreferenceCategory&gt;
  
  &lt;/PreferenceScreen&gt;
  </code></pre>
  
  <p>So now i have the activity for the setting activity. But i want to display the value of the EditTextPref in <code>android:summary</code>.
  I have found many topics but all the functions was deprecated.</p>
  
  <p>EDIT : thanks to @Ace_McIntosh , I edited my code for people who want it, it's working now.</p>