Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: Changing a preference via dialog does not update the value
    primarykey
    data
    text
    <p>I'm using a PreferenceActivity in my app. Defined the settings.xml as follows -</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" android:title="Preferences" &gt; &lt;PreferenceCategory android:title="Email Options" &gt; &lt;EditTextPreference android:dialogTitle="@string/pref_email_user_title" android:key="pref_email_user" android:summary="@string/pref_email_user_summary" android:persistent="true" android:title="@string/pref_email_user_title" /&gt; &lt;EditTextPreference android:dialogTitle="@string/pref_email_password_title" android:key="pref_email_password" android:summary="@string/pref_email_password_summary" android:persistent="true" android:title="@string/pref_email_password_title" /&gt; &lt;/PreferenceCategory&gt; </code></pre> <p></p> <p>Activity as follows -</p> <pre><code>public class Prefs extends PreferenceActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.settings); } } </code></pre> <p>Which is all you need, right? Apparently not though, because what happens is that I click on the 'email user' setting, it brings up a dialog which I use to type in a string value. However what I typed in isn't getting placed on the Settings screen, I still see the default value.</p> <p>I notice that the values are getting persisted in the preferences file under <code>/data/data/&lt;package&gt;/shared_prefs</code></p> <p>I also don't see these persisted values when I relaunch the app - it shows default values. What's the bit of magic I'm missing?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload