title: addPreferencesFromResource makes sharedPreferences not work
body: <p>So probably another newbish question :)</p>
  
  <p>I have an <code>Activity</code>, an <code>AppWidgetProvider</code> and a <code>PreferenceActivity</code>. In the <code>PreferenceActivity</code> I have a <code>ListPreference</code> which I use to define the text-size for the widget. The <code>sharedPreferences</code> are loaded with no problems when the main activity starts, but as soon as the <code>PreferenceActivity</code> is run, I can no longer retrieve the <code>sharedPreference</code> values properly in the main activity. I tried retrieving the <code>sharedPreference</code> values directly in the <code>PreferenceActivity</code> and the same thing happened: For some reason when I try to get the values from the <code>sharedPreferences</code> BEFORE I call <code>addPreferencesFromResource(R.drawable.settings);</code> (at comment 'Test 1'), it says:</p>
  
  <blockquote>
    <p>"onStart() 1, size: small" and "Small works!"</p>
  </blockquote>
  
  <p>I.e. it works. But when I try to retrieve the values AFTER the resource-call (at comment 'Test 2'), it says:</p>
  
  <blockquote>
    <p>"onStart() 2, size: small" and "It doesn't work ..."</p>
  </blockquote>
  
  <p>I.e. it DOESN'T work. I have NO idea why. Obviously it gets the value of the <code>sharedPreference</code> as it says that the current <code>textWidgetSize</code> equals "small" in both cases, but for some reason it doesn't think that "small" = "small" after the resource-call. Do you guys have any idea what's wrong?</p>
  
  <p>Here's the PreferenceActivity code:</p>
  
  <pre><code>package dk.mfoller.android.basicnote;
  
  import android.content.SharedPreferences;
  import android.os.Bundle;
  import android.preference.PreferenceActivity;
  import android.preference.PreferenceManager;
  import android.widget.Toast;
  import dk.mfoller.android.basicnote.R;
  
  public class BasicNoteSettings extends PreferenceActivity{
  
      String widgetTextSize = "small";
      boolean widgetLineCounter = true;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          // Calls a function to get the preferences
          getPrefs();
  
          // Test 1
          makeToast("onStart() 1, size: " + widgetTextSize);
          if(widgetTextSize == "small") {
              makeToast("Small works!");
          } else if(widgetTextSize == "medium") {
              makeToast("Medium works!");
          } else if(widgetTextSize == "large") {
              makeToast("Large works!");
          } else {
              makeToast("It doesn't work ...");
          }
  
          // Gets the preference layout from xml
          addPreferencesFromResource(R.drawable.settings);
  
          // Calls a function to get the preferences
          getPrefs();
  
          // Test 2
          makeToast("onStart() 2, size: " + widgetTextSize);
          if(widgetTextSize == "small") {
              makeToast("Small works!");
          } else if(widgetTextSize == "medium") {
              makeToast("Medium works!");
          } else if(widgetTextSize == "large") {
              makeToast("Large works!");
          } else {
              makeToast("It doesn't work ...");
          }
  
      }
  
      // A function to get the preferences    
      private void getPrefs() {
          // Gets data from the shared preferences
          SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
          widgetTextSize = prefs.getString("text_size_list", "small");
          widgetLineCounter = prefs.getBoolean("line_counter_cbox", true);
      }
  
      // A function to display a popup
      private void makeToast(String popup) {
          Toast.makeText(this, popup, Toast.LENGTH_SHORT).show();
      }
  
  }
  </code></pre>
  
  <p>Here's the xml-document:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
      android:key="basicnote_settings"
      android:title="@string/settings_label"&gt;
  
      &lt;PreferenceCategory android:title="Text size"&gt;
          &lt;ListPreference android:key="text_size_list"
          android:title="Widget text size"
          android:summary="@string/text_size_summary"
          android:entries="@array/text_size_options"
          android:entryValues="@array/text_size_values"
          android:defaultValue="small" /&gt;
      &lt;/PreferenceCategory&gt;
  
      &lt;PreferenceCategory android:title="Other settings"&gt;
          &lt;CheckBoxPreference android:key="line_counter_cbox"
              android:title="Line counter"
              android:summary="@string/hidden_lines_summary"
              android:defaultValue="true" /&gt;
      &lt;/PreferenceCategory&gt;
  
  &lt;/PreferenceScreen&gt;
  </code></pre>
  
  <p>And here are my resource strings:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;!-- Defines various resources --&gt;
  &lt;resources&gt;
      &lt;string name="app_name"&gt;basicNote&lt;/string&gt;
      &lt;string name="note_hint"&gt;Tap to add some notes ...&lt;/string&gt;
      &lt;string name="fake_load"&gt;Loading notes ...&lt;/string&gt;
  
      &lt;string name="settings_label"&gt;basicNote settings&lt;/string&gt;
  
      &lt;string name="text_size_summary"&gt;Set the size of the widget text&lt;/string&gt;
      &lt;string-array name="text_size_options"&gt;
          &lt;item&gt;Small (12sp)&lt;/item&gt;
          &lt;item&gt;Medium (13sp)&lt;/item&gt;
          &lt;item&gt;Large (15sp)&lt;/item&gt;
      &lt;/string-array&gt;
      &lt;string-array name="text_size_values"&gt;
          &lt;item&gt;small&lt;/item&gt;
          &lt;item&gt;medium&lt;/item&gt;
          &lt;item&gt;large&lt;/item&gt;
      &lt;/string-array&gt;
  
      &lt;string name="hidden_lines_summary"&gt;Show/hide the number of lines not shown in the widget&lt;/string&gt;
  &lt;/resources&gt;
  </code></pre>