My preferences aren't 'sticking'
<p>I'm trying to create a settings section for my app. I have a res/xml/settings.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;ListPreference 
    android:key="numberOfYears"
    android:title="Number of Years to Read the Bible"
    android:summary="How many years would you like to take to read through the reading plan?"
    android:entries="@array/numberOfYears"
    android:entryValues="@array/numberOfYears"
    android:dialogTitle="How Many Years?"
    /&gt;
  &lt;CheckBoxPreference android:key="ignoreDates"
    android:title="Ignore Dates"
    android:summary="Would you like to use the dates in the plan?"
  /&gt;
&lt;/PreferenceScreen&gt;
</code></pre>

<p>I have a class called Preferences which extends PreferenceActivity and contains the following:</p>

<pre><code>@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.settings);
}
</code></pre>

<p>I wasn't sure if this was required but I also added the following to my main activity:</p>

<pre><code>@Override
public boolean onCreateOptionsMenu(Menu menu) {
    menu.add(Menu.NONE, PREFS_MENU, Menu.NONE, "Preferences");
    return super.onCreateOptionsMenu(menu);
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    Log.d(TAG, "Menu Item: " + item.getItemId());
    switch (item.getItemId()) {
    case PREFS_MENU :
        startActivity(new Intent(this, Preferences.class));
        return true;
    }
    return false;
}
</code></pre>

<p>This seems to work in that I get a "Preferences" menu which, when selected, launches my preferences.  However, when I select anything the values don't seem to stick.  My understanding was that the android:key was enough for the system to set the chosen values in the default shared preferences - is this not the case?</p>

<p>What am I missing?</p>
