Okay, so my current suspicion is that I got bitten by http://code.google.com/p/android/issues/detail?id=1707
I have one preference value containing "<" and ">" which are improperly encoded due to above bug. My guess is that the XML parser chokes on this value and the pref file is ignored. I think SharedPreferences only reads data from disk after the process is killed, so the app is fully functional until it is killed. Also, it was not consistently reproducible because this pref value is not always present in my application. I've removed "<" and ">" from the pref value and see how it goes. Christoph On Sat, Jan 24, 2009 at 6:56 PM, Christoph Studer <chstu...@gmail.com> wrote: > Hello, > > I'm making use of SharedPreferences in my application. One part is a > PreferenceActivity and the other part is a backend that accesses the > preferences using PreferenceManager.getDefaultSharedPreferences(...). > Both parts are running in the same process, but potentially in > different threads. > > Now, from time to time, I encounter a reset of all the preferences. It > looks to me like this happens when my process is killed (e.g. when > installing a new version or starting the activity or service the first > time after a long time). However, it is not reproducible by killing > the process manually and it does not happen consistently. > > Are there other people who have the same problem? Is there a race > condition that could lead to something like this? > > The source code of my app can be found here: > http://code.google.com/p/android-sms/source/browse/ > > The relevant files are: > http://code.google.com/p/android-sms/source/browse/trunk/android-client/src/tv/studer/smssync/SmsSync.java > and > http://code.google.com/p/android-sms/source/browse/trunk/android-client/src/tv/studer/smssync/PrefStore.java > > Thank you, > > > Christoph > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---