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.
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;
      }
    });
  }
}
xml file is
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
  <EditTextPreference 
    android:title="User Name"
    android:key="username" 
    android:summary="Please provide user name" />
  <EditTextPreference 
    android:title="Password" 
    android:password="true"
    android:key="password" 
    android:summary="Please enter your password" />
</PreferenceScreen>
actually my code update previous enter value as summary text. How to show text as summary when I click ok button. Thanks
 
     
     
     
     
    