One pattern for using XML preferences is to run
addPreferencesFromResource once and only once, the first time your app
is executed.  You probably know that preferences can be saved and
persist from one run of the application to the next.  Use a boolean
preference to determine if it is the first run of the app.  In
subsequent logic and based on conditions, you can set the value of the
preference by fetching the shared preferences (getSharedPreferences)
and creating an editor to write out the correct value.  Set your
defaults once, in XML or in code.  After that, set the value. It will
display in the PreferencesActivity as you expect it to.

It sounds like you might run addPreferencesFromResource and load
defaults every time.  Maybe that is not the case...  If your app
requires loading defaults each time, just set the correct value after
loading defaults, as needed.  In the Preferences Activity you can use
both onResume and onPreferenceClick to manage the appearance of
preferences (that is what I do).  You might use these functions to
manage preference values as well.

I hope this makes sense.
Regards,
Beth

On Dec 11, 6:38 pm, spocky12 <[email protected]> wrote:
> I've encountered the same behaviour a few days ago. I'm wondering if
> there's a way to "fix" it.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to