how to update EditTextPreference existing summary when i click ok button
<p>dear 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 pls update in my code which required...v.v thanks in advance..</p>

<pre><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>}</p>

<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&gt;
 &lt;EditTextPreference android:title="Password" android:password="true"
  android:key="password" android:summary="Please enter your password"&gt;        &lt;/EditTextPreference&gt;
</code></pre>

<p></p>

<p>actually my code update previous enter value as summary text  ...how to show text as summary when i click ok button..thanks</p>
