title: how to update EditTextPreference existing summary when i click ok button
body: <p>I am able to show EditTextPreference with default summary. Now i want to update it when i enter new value in  Edit Text box and click ok then it should be upadate the value of summary. But i am unable to do that. My code is below please update in my code which required. </p>
  
  <pre class="lang-java prettyprint-override"><code>public class Prefs extends PreferenceActivity {
  
    @Override
    public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      addPreferencesFromResource(R.xml.prefs);
  
      final EditTextPreference pref = (EditTextPreference)findPreference("username");
      pref.setSummary(pref.getText());
      pref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
        public boolean onPreferenceChange(Preference preference, Object newValue) {
          final EditTextPreference pref = (EditTextPreference)findPreference("username");
  
          pref.setSummary(pref.getText());
  
          return true;
        }
      });
    }
  }
  </code></pre>
  
  <p>xml file is </p>
  
  <pre><code>&lt;PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"&gt;
    &lt;EditTextPreference 
      android:title="User Name"
      android:key="username" 
      android:summary="Please provide user name" /&gt;
    &lt;EditTextPreference 
      android:title="Password" 
      android:password="true"
      android:key="password" 
      android:summary="Please enter your password" /&gt;
  &lt;/PreferenceScreen&gt;
  </code></pre>
  
  <p>actually my code update previous enter value as summary text. How to show text as summary when I click ok button. Thanks</p>