title: Android shared preferences not being saved
body: <p>I got very simple preferences page in my app:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"&gt;
     &lt;CheckBoxPreference
         android:key="autoCheck"
         android:title="@string/autoCheckLbl"
         android:defaultValue="true"
         android:summary="@string/autoCheckDesc" 
      /&gt;   
  &lt;/PreferenceScreen&gt;
  </code></pre>
  
  <p>This settings file is managed by custom PreferenceActivity, which does nothing but:</p>
  
  <pre><code>public class SettingsActivity extends PreferenceActivity
  {
      protected void onCreate(Bundle savedState) 
      {
          super.onCreate(savedState);
  
          addPreferencesFromResource(R.xml.settings);
      }
  }
  </code></pre>
  
  <p>Problem is, when user make some change, i.e. check/uncheck that setting, it seems like that change isn't saved. For example, when user navigates back to the main activity, in which I'm retrieving current value of a <em>autoCheck</em> setting, this way:</p>
  
  <pre><code>boolean autoCheck = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("autoCheck", true);
  </code></pre>
  
  <p>... retrieved value is not the one that was previously set by user. Only after the Android emulator is restarted, new value is correctly set.</p>