how to get value from SharedPreferences?
<p>I have been making application which uses Preferences. I have following PreferenceActivity:</p>

<pre><code>public class PreferencesActivity extends PreferenceActivity{

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.addPreferencesFromResource(R.xml.prefences);

        PreferenceManager.setDefaultValues(this, R.xml.prefences, true);
    }
}
</code></pre>

<p>also I have following preferences.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;EditTextPreference android:key="device_id" android:title="Device ID"/&gt;
    &lt;ListPreference android:key="update_time" android:entries="@array/update_keys" android:entryValues="@array/update_values" android:title="Update time" android:defaultValue="28800000"/&gt;
&lt;/PreferenceScreen&gt;
</code></pre>

<p>and I try to get values from SharedPreferences in onCreate() method my main Activity:</p>

<pre><code>@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    initializeOtherElements();

    SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(getBaseContext());
    Log.e("key", String.valueOf(prefs.getString("device_id", "1")));
}
</code></pre>

<p>I have added PreferencesActivity into manifest. But I see "1" in Log always. Where have I made a mistake?</p>
