Issue reading preferences in android activity
<p>I'm trying to use the PreferenceActivity in a java app and I'm able to bring up a screen to modify the preferences but I'm unable to read the preferences in a nother activity in the same App.</p>

<p>I have one xml file under the xml/ folder called default_values.xml that contains just a single preference. </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="json_url_pref"
        android:defaultValue="@string/json_url"
        android:title="@string/title_edittext_preference"
        android:summary="@string/summary_edittext_preference"
        android:dialogTitle="@string/dialog_title_edittext_preference" /&gt;


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

<p>This is the code I'm trying to use in my Activity to read the preference:</p>

<pre><code>SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(EarningsActivity.this);
String tmp = sp.getString("json_url_pref","-1");
</code></pre>

<p>sp.getString(...) is always returning -1.</p>

<p>I think this is a contextual issue that for some reason this activity does not have access to the application preferences (at least my intention is to have the preferences be visible by all activities in the application).</p>
