title: Preference cannot cast java.lang.boolean to String
body: <p>I have the following Preference class:</p>
  
  <pre><code>public class AppPreferencesActivity extends PreferenceActivity {
      private SharedPreferences appPrefs;
      private SharedPreferences.Editor prefEditor;
      private Mediator mediator;
      private SharedPreferences.OnSharedPreferenceChangeListener listener;
      private User user;
      @SuppressWarnings("deprecation")
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          //---load the preferences from an XML file---
          addPreferencesFromResource(R.xml.preferences);
          this.appPrefs = PreferenceManager.getDefaultSharedPreferences(this);
          this.mediator = (Mediator) getApplication();    
          this.prefEditor = appPrefs.edit();
          this.user = mediator.getUser();
          setPreferences();
          listener = new SharedPreferences.OnSharedPreferenceChangeListener() {
              public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
                  // Implementation
                  updatePreference(key);
                  Toast.makeText(AppPreferencesActivity.this,
                          "Information updated",
                          Toast.LENGTH_SHORT).show();
              }
          };
          appPrefs.registerOnSharedPreferenceChangeListener(listener);
  
      } 
      private void setPreferences(){
          prefEditor.putString("nameEdit", user.getName() + " "+user.getLastName());
          prefEditor.putString("streetEdit", user.getStreetName());
          prefEditor.putString("streetNumberEdit", ""+user.getStreetNr());
          prefEditor.putString("emailEdit", user.getEmail());
          prefEditor.commit();
          preferenceAddSummary();
      }
      public boolean checkEmailStatus(){
          return appPrefs.contains("emailEdit");
      }
      @SuppressWarnings("deprecation")
      private void preferenceAddSummary() {
          for (Entry&lt;String, ?&gt; key : appPrefs.getAll().entrySet()) {
              findPreference(key.getKey()).setSummary(appPrefs.getString(key.getKey(), "Not yet entered")); 
  // this is where im getting the error
  
              }
  </code></pre>
  
  <p>However when i run this i get the following </p>
  
  <blockquote>
    <p>Cannot cast Java.lang.boolean to Java.lang.String</p>
  </blockquote>
  
  <p>I get this error at the loop im calling to setSumary can anyone tell me why this is happening?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Full stackTrace in text:</p>
  
  <pre><code>   05-02 02:28:15.835: E/AndroidRuntime(1775): FATAL EXCEPTION: main
  05-02 02:28:15.835: E/AndroidRuntime(1775): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.konkurrencesigner/com.example.konkurrencesigner.AppPreferencesActivity}: java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.String
  05-02 02:28:15.835: E/AndroidRuntime(1775):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
  05-02 02:28:15.835: E/AndroidRuntime(1775):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
  05-02 02:28:15.835: E/AndroidRuntime(1775):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
  05-02 02:28:15.835: E/AndroidRuntime(1775):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
  05-02 02:28:15.835: E/AndroidRuntime(1775):     at android.os.Handler.dispatchMessage(Handler.java:99)
  05-02 02:28:15.835: E/AndroidRuntime(1775):     at android.os.Looper.loop(Looper.java:137)
  05-02 02:28:15.835: E/AndroidRuntime(1775):     at android.app.ActivityThread.main(ActivityThread.java:5039)
  05-02 02:28:15.835: E/AndroidRuntime(1775):     at java.lang.reflect.Method.invokeNative(Native Method)
  05-02 02:28:15.835: E/AndroidRuntime(1775):     at java.lang.reflect.Method.invoke(Method.java:511)
  05-02 02:28:15.835: E/AndroidRuntime(1775):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
  05-02 02:28:15.835: E/AndroidRuntime(1775):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
  05-02 02:28:15.835: E/AndroidRuntime(1775):     at dalvik.system.NativeStart.main(Native Method)
  05-02 02:28:15.835: E/AndroidRuntime(1775): Caused by: java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.String
  05-02 02:28:15.835: E/AndroidRuntime(1775):     at android.app.SharedPreferencesImpl.getString(SharedPreferencesImpl.java:224)
  05-02 02:28:15.835: E/AndroidRuntime(1775):     at com.example.konkurrencesigner.AppPreferencesActivity.preferenceAddSummary(AppPreferencesActivity.java:55)
  05-02 02:28:15.835: E/AndroidRuntime(1775):     at com.example.konkurrencesigner.AppPreferencesActivity.setPreferences(AppPreferencesActivity.java:47)
  05-02 02:28:15.835: E/AndroidRuntime(1775):     at com.example.konkurrencesigner.AppPreferencesActivity.onCreate(AppPreferencesActivity.java:28)
  05-02 02:28:15.835: E/AndroidRuntime(1775):     at android.app.Activity.performCreate(Activity.java:5104)
  05-02 02:28:15.835: E/AndroidRuntime(1775):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
  05-02 02:28:15.835: E/AndroidRuntime(1775):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
  05-02 02:28:15.835: E/AndroidRuntime(1775):     ... 11 more
  </code></pre>