title: Preference summary with current value throug custom EditTextPreference: how to get current value?
body: <p>Inspired by <a href="https://stackoverflow.com/questions/531427/how-do-i-display-the-current-value-of-an-android-preference-in-the-preference-summary">how-do-i-display-the-current-value-of-an-android-preference-in-the-preference-summary</a> i created my own EditTextPreference that shows its current value in the PreferenceScreen.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;PreferenceScreen android:key="preferences" xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;PreferenceCategory 
          android:title="First Category"
          android:key="first_category"&gt;
  
          &lt;de.k3b.widgets.EditTextPreferenceWithSummary
              android:key="test"
              android:title="Test Message" 
              android:dialogTitle="Test Message"
              android:dialogMessage="Provide a message"   
              android:defaultValue="Default welcome message" /&gt;
  
      &lt;/PreferenceCategory&gt;
  &lt;/PreferenceScreen&gt;
  </code></pre>
  
  <p>The implementation looks like this</p>
  
  <pre><code>package de.k3b.widgets;
  
  import android.content.Context;
  import android.content.SharedPreferences;
  import android.preference.*;
  import android.util.AttributeSet;
  import android.util.Log;
  
  public class EditTextPreferenceWithSummary extends EditTextPreference {
      private final static String TAG = EditTextPreferenceWithSummary.class.getName();
  
      public EditTextPreferenceWithSummary(Context context, AttributeSet attrs) {
          super(context, attrs);
          init();
      }
  
      public EditTextPreferenceWithSummary(Context context) {
          super(context);
          init();
      }
  
      private void init() {
          Log.e(TAG, "init");
          SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this.getContext());     
          String currentText = test prefs.getString("minTrashholdInSecs", this.getText());
  
  // where do i get the current value of the underlaying EditTextPreference ??
  //      vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
          this.setSummary(this.getText());
  //      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  
          setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
  
              @Override
              public boolean onPreferenceChange(Preference preference, Object newValue) {
                  Log.w(TAG, "display score changed to "+newValue);
                  preference.setSummary(newValue.toString()); // getSummary());
                  return true;
              }
          });
      }
  }
  </code></pre>
  
  <p>When the PreferenceScreen is first shown there is no current value displayed.</p>
  
  <p>My problem: <strong>Where do i get the current value that the EditTextPreference represents?</strong>
  getText() does not get the value as i expected.
  After changing the preferencevalue this value is shown in the summary field as expected. </p>
  
  <p>Im am using android 2.2</p>