Well Mark the problem is that I am using the suggested way to save the settings. I do commit every single edit() like suggested. But a lot of users are still reporting that they lose settings. I don't know why but it happens some times. :( (I have worked with my app for 2 months now and have never lost the settings)
To sum up I don't like the suggestion using Sqlite because I would just ignore a bug which is obviously there but no one knows what it really is. On May 3, 11:41 pm, Mark Murphy <[email protected]> wrote: > Filipe Abrantes wrote: > > indeed... i am experiencing this problem. my app uses a background > > service that sometimes gets killed by the system. When that happens the > > sharedprefs are lost. If the app force closes due to some unhandled > > exception the prefs are also lost for good. > > I have had many, many force-closes, and none of them have damaged shared > preferences. > > Are you holding an open editor object? I can definitely see where that, > coupled with a force-close, might cause problems. As was suggested > earlier in the thread, commit your editors as soon as possible: > > settings > .edit() > .putString(SOME_STRING, "Hello world.") > // maybe some more put...() method calls here > .commit(); > > > Im moving to good old .conf files :P... > > What makes you think that will help? > > Shared preferences are stored in "good old" flat files, in XML format. > Switching to some other form of flat file is unlikely to improve your > situation. > > If you want transactional integrity, use a SQLite database. > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://twitter.com/commonsguy > > Warescription: Three Android Books, Plus Updates, $35/Year --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

