title: PreferenceActivity Settings not Saved
body: <p>EDIT: I tried this new code but it still seems they are reset. Can anyone tell me, and propose a solution to my settings being reset?</p>
  
  <pre><code>public class UserSettingActivity extends PreferenceActivity implements OnPreferenceChangeListener{
  
      static SwitchPreference mucus_stamps;
      static SwitchPreference fertile_infertil;
      static SwitchPreference cervical_mucus;
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
      }
  
      /**
       * Populate the activity with the top-level headers.
       */
      @Override
      public void onBuildHeaders(List&lt;Header&gt; target) {
          Log.i("PROJECTCARUSO","onBuildHeaders");
          loadHeadersFromResource(R.xml.preference_headers, target);
  
      }
  
      /**
       * This fragment shows the preferences for the first header.
       */
      public static class Prefs1Fragment extends PreferenceFragment {
          @Override
          public void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
  
              // Load the preferences from an XML resource
              addPreferencesFromResource(R.xml.notification_settings);
          }
      }
  
      /**
       * This fragment shows the preferences for the second header.
       */
      public static class Prefs2Fragment extends PreferenceFragment {
          @Override
          public void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
  
              // Load the preferences from an XML resource
              addPreferencesFromResource(R.xml.charting_settings);
  
              //findPreference("cervical_mucus").setOnPreferenceChangeListener(
                      mucus_stamps = (SwitchPreference) findPreference("mucus_stamps");
                      fertile_infertil = (SwitchPreference) findPreference("fertile_infertil"); 
                      cervical_mucus = (SwitchPreference) findPreference("cervical_mucus"); 
  
                      cervical_mucus.setOnPreferenceChangeListener(
                                new OnPreferenceChangeListener() {
  
                                       @Override
                                       public boolean onPreferenceChange(Preference preference, Object newValue) {
  
                                           // string test w/o "==" usage.
                                           if (newValue.equals(false)) {
                                               Log.i("PROJECTCARUSO","false");
                                               mucus_stamps.setChecked(false);
                                               fertile_infertil.setChecked(false);
  
                                           } else {
                                               Log.i("PROJECTCARUSO","true");
                                               mucus_stamps.setChecked(true);
                                               fertile_infertil.setChecked(true);
                                           }
  
                                           // true instead of false so the new value gets kept
                                           return true;
                                       };
                                });
  
  
                        if(!cervical_mucus.isChecked()){
                               mucus_stamps.setSelectable(false);
                               mucus_stamps.setEnabled(false);
  
                               fertile_infertil.setSelectable(false);
                               fertile_infertil.setEnabled(false);
                           } else {
                               mucus_stamps.setSelectable(true);
                               mucus_stamps.setEnabled(true);
  
                               fertile_infertil.setSelectable(true);
                               fertile_infertil.setEnabled(true);
                           }
          }
      }
  
      protected void onPause()
      {
          super.onPause();
      }
  
      protected void onResume()
      {
          super.onResume();
      }
  
  
      @Override
      public boolean onPreferenceChange(Preference arg0, Object arg1) {
          // TODO Auto-generated method stub
          return true;
      }
  
  }
  </code></pre>
  
  <p>XML:</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;PreferenceCategory 
           android:title="@string/pref_chart_profile" 
           android:textSize="20px"&gt;
  
          &lt;SwitchPreference  
                  android:title="@+string/pref_symptothermal"
                  android:summary="@+string/pref_symptothermal_summary"
                  android:key="symptothermal"
                  android:defaultValue="true"
                  android:layout="@layout/pref_layout"/&gt;
  
          &lt;SwitchPreference 
                  android:id="@+id/cervical_mucus"
                  android:title="@+string/pref_cervical_mucus"
                  android:summary="@+string/pref_cervical_mucus_summary"
                  android:key="cervical_mucus"
                  android:defaultValue="true"
                  android:layout="@layout/pref_layout" /&gt;    
  
          &lt;SwitchPreference 
                  android:id="@+id/mucus_stamps"
                  android:title="@+string/pref_mucus_stamps"
                  android:summary="@+string/pref_mucus_stamps_summary"
                  android:key="mucus_stamps"
                  android:defaultValue="true"
                  android:layout="@layout/pref_layout" /&gt;
  
          &lt;SwitchPreference 
                  android:id="@+id/fertile_infertil"
                  android:title="@+string/pref_fertile_infertile"
                  android:summary="@+string/pref_fertile_infertile_summary"
                  android:key="fertile_infertil" 
                  android:defaultValue="true"
                  android:layout="@layout/pref_layout" /&gt;
      &lt;/PreferenceCategory&gt;
  
  &lt;/PreferenceScreen&gt;
  </code></pre>