How to get values from SharedPreferences from another Activity?
<p>There is the main Activity with the following code in onCreate method:</p>

<pre><code>PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
SharedPreferences prefs=MainActivity.this.getSharedPreferences("com.qerq.helloworldproject.PreferencesActivity", Activity.MODE_PRIVATE);
String editText=prefs.getString("edit_text", "default_edit_text_value");
boolean checkBox=prefs.getBoolean("check_box", true);
String list=prefs.getString("list", "default_list_value");

Log.i("edit_text_value", editText);
Log.i("check_box_value", String.valueOf(checkBox));
Log.i("list_value", list);
</code></pre>

<p>and there is xml layout for PreferencesActivity:</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
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:key="first_screen_key"
        android:summary="First summary"
        android:title="First title" &gt;
        &lt;CheckBoxPreference
            android:persistent="true"
            android:title="Check Box Title"
            android:key="check_box_key"
            android:defaultValue="false"/&gt;
        &lt;ListPreference 
            android:persistent="true"
            android:title="List Title"
            android:key="list_key"
            android:entries="@array/entries"
            android:defaultValue="second_value"
            android:entryValues="@array/entries_values"/&gt;
        &lt;EditTextPreference 
            android:persistent="true"
            android:title="Edit Text Title"
            android:key="edit_text_key"
            android:defaultValue="Edit Text Value"/&gt;
    &lt;/PreferenceCategory&gt;

&lt;/PreferenceScreen&gt;
</code></pre>

<p>But I get only default values always from code always! I need to change values using PreferencesActivity, but I also need to get values from source code in MainActivity. How can  I do it?</p>
