[android-developers] Re: SharedPreferences got deleted! - What could be the problem?
I don't see anything in that example, but until http://code.google.com/p/android/issues/detail?id=1707 is released, I have been escaping all user generated strings before saving them. This has cut down my user complaints after I figured out they were putting these problem characters into the fields. On May 7, 4:22 pm, so_is wrote: > Well I know this bug. Here are the characters which can be in my > settings file: > > http://paste.pocoo.org/show/lqqABv2lblNz1Bkh9XNs/ > > Is there anything that could cause problems? > > On May 7, 3:18 pm, dar wrote: > > > Try putting in xml special characters into the strings you are saving > > directly with the editor without xml-escaping them, e.g. &'<>" and see > > if this reproduces the problem when you try to read in the saved > > preferences after your app has been killed (after a reboot, for > > example). > > > On May 7, 5:24 am, so_is wrote: > > > > Thank you very much for your comment Mark. > > > > Well at the moment I am prior to redo the whole preferences saving my > > > settings into a Sqlite database. > > > > I can not find the bug in my code and my app relies on this settings > > > so I don't see any other chance to get rid of the lost settings bug. > > > > On May 6, 12:56 pm, Mark Murphy wrote: > > > > > so_is wrote: > > > > > 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) > > > > > It will be difficult to fix the bug without a repeatable scenario. > > > > > > 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. > > > > > If you can come up with a repeatable scenario for theSharedPreferences > > > > damage, post an issue tohttp://b.android.comwithaprojectand > > > > instructions for causing the problem. > > > > > Otherwise, if I were in your shoes, I would switch to some other means > > > > (e.g., SQLite) of storing the data you are storing inSharedPreferences, > > > > simply to make your users happy. > > > > > -- > > > > 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 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 -~--~~~~--~~--~--~---
[android-developers] Re: SharedPreferences got deleted! - What could be the problem?
Just on a hunch as I have not tried it, can you remove the content URL's from your preference file and try it again (form the url inside your code, and store the variable number in prefs) Again, I have not received any lost shared prefs complaints from anyone and I did not lose any in the last couple of months during my testing. I only have simple data (no urls, no comma's), but cover all the datatypes in the preferences. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: SharedPreferences got deleted! - What could be the problem?
Well I know this bug. Here are the characters which can be in my settings file: http://paste.pocoo.org/show/lqqABv2lblNz1Bkh9XNs/ Is there anything that could cause problems? On May 7, 3:18 pm, dar wrote: > Try putting in xml special characters into the strings you are saving > directly with the editor without xml-escaping them, e.g. &'<>" and see > if this reproduces the problem when you try to read in the saved > preferences after your app has been killed (after a reboot, for > example). > > On May 7, 5:24 am, so_is wrote: > > > Thank you very much for your comment Mark. > > > Well at the moment I am prior to redo the whole preferences saving my > > settings into a Sqlite database. > > > I can not find the bug in my code and my app relies on this settings > > so I don't see any other chance to get rid of the lost settings bug. > > > On May 6, 12:56 pm, Mark Murphy wrote: > > > > so_is wrote: > > > > 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) > > > > It will be difficult to fix the bug without a repeatable scenario. > > > > > 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. > > > > If you can come up with a repeatable scenario for theSharedPreferences > > > damage, post an issue tohttp://b.android.comwithaproject and > > > instructions for causing the problem. > > > > Otherwise, if I were in your shoes, I would switch to some other means > > > (e.g., SQLite) of storing the data you are storing inSharedPreferences, > > > simply to make your users happy. > > > > -- > > > 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 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 -~--~~~~--~~--~--~---
[android-developers] Re: SharedPreferences got deleted! - What could be the problem?
Try putting in xml special characters into the strings you are saving directly with the editor without xml-escaping them, e.g. &'<>" and see if this reproduces the problem when you try to read in the saved preferences after your app has been killed (after a reboot, for example). On May 7, 5:24 am, so_is wrote: > Thank you very much for your comment Mark. > > Well at the moment I am prior to redo the whole preferences saving my > settings into a Sqlite database. > > I can not find the bug in my code and my app relies on this settings > so I don't see any other chance to get rid of the lost settings bug. > > On May 6, 12:56 pm, Mark Murphy wrote: > > > so_is wrote: > > > 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) > > > It will be difficult to fix the bug without a repeatable scenario. > > > > 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. > > > If you can come up with a repeatable scenario for theSharedPreferences > > damage, post an issue tohttp://b.android.comwitha project and > > instructions for causing the problem. > > > Otherwise, if I were in your shoes, I would switch to some other means > > (e.g., SQLite) of storing the data you are storing inSharedPreferences, > > simply to make your users happy. > > > -- > > 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 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 -~--~~~~--~~--~--~---
[android-developers] Re: SharedPreferences got deleted! - What could be the problem?
Thank you very much for your comment Mark. Well at the moment I am prior to redo the whole preferences saving my settings into a Sqlite database. I can not find the bug in my code and my app relies on this settings so I don't see any other chance to get rid of the lost settings bug. On May 6, 12:56 pm, Mark Murphy wrote: > so_is wrote: > > 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) > > It will be difficult to fix the bug without a repeatable scenario. > > > 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. > > If you can come up with a repeatable scenario for theSharedPreferences > damage, post an issue tohttp://b.android.comwith a project and > instructions for causing the problem. > > Otherwise, if I were in your shoes, I would switch to some other means > (e.g., SQLite) of storing the data you are storing inSharedPreferences, > simply to make your users happy. > > -- > 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 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 -~--~~~~--~~--~--~---
[android-developers] Re: SharedPreferences got deleted! - What could be the problem?
so_is wrote: > 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) It will be difficult to fix the bug without a repeatable scenario. > 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. If you can come up with a repeatable scenario for the SharedPreferences damage, post an issue to http://b.android.com with a project and instructions for causing the problem. Otherwise, if I were in your shoes, I would switch to some other means (e.g., SQLite) of storing the data you are storing in SharedPreferences, simply to make your users happy. -- 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 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 -~--~~~~--~~--~--~---
[android-developers] Re: SharedPreferences got deleted! - What could be the problem?
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 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 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 -~--~~~~--~~--~--~---
[android-developers] Re: SharedPreferences got deleted! - What could be the problem?
Mark Murphy 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(); > > it may be the case... however I have run through the code a few times and didn't find an editor object that could be left open. Even if that is the case, I'd like to propose to the android dev team to make such coding errors less catastrophic... (not bashing just a suggestion - if for some reason an editor is left open the whole prefs should not disappear). >> 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. > > 1) files is something I understand... and have control over. dont know if I leave a file open, its contents will be gone for good... but its something I am about to experiment :P. SQLite would be an option but is definitely more work for such simple tasks, and I have had some trouble with those too (specially with access from different threads...). You can call me lazy but in the end I just dont feel like spending much time on this type of functionality and rather concentrate on other aspects of the apps that I feel are way cooler :P. Thanks for the input. Filipe --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: SharedPreferences got deleted! - What could be the problem?
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 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 -~--~~~~--~~--~--~---
[android-developers] Re: SharedPreferences got deleted! - What could be the problem?
On Apr 24, 1:17 am, Dianne Hackborn wrote: > You really really should commit the data after you make each batch of > changes, as the docs say. It is certainly very possible for the system to > kill your process between onPause() and onStop() if it is under memory > pressure. > There's probably a deeper issue here. I've built a few utility functions to handle preferences both in a SQLite db and the regular preferences - in one call. While the regular preferences are getting lost on occasion - I've yet to see this with the SQLite db. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: SharedPreferences got deleted! - What could be the problem?
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. Im moving to good old .conf files :P... Beware fo the sharedprefs... Cheers, Filipe scanning_it wrote: > Yeah well it would be nice if we could find the problem. It is pretty > annoying to have this problem using the basic SDK features. > > On Apr 24, 6:03 pm, bo wrote: > >> That's pretty much what I do also (why take any chances?). Now - all >> that business with & gets me thinking. I'm actually storing some >> snippets of unescaped HTML (which I actually don't care about much). I >> think these I'll move to Bundle and see if my "real" preferences will >> persist >> >> On Apr 24, 3:09 am, scanning_it wrote: >> >> >>> Thank you Dianne for joining the discussion. >>> >>> I will look into my code again but I'm sure that this is the only way >>> I am writting to theSharedPreferences: >>> >>> settings.edit().putString(SOME_STRING, "Hello world.").commit(); >>> >>> So there shouldn't be a problem with that one. >>> >>> Is it possible thatSharedPreferencescould get lost when a background >>> services writes to theSharedPreferencesfile and gets killed during >>> that process? In my background service I am updating e.g. some shared >>> prefs that tell me if I have set a specific notification or not. >>> >>> Could this usage in services be a problem? >>> >>> In addition it would be interesting why a lot of users are complaining >>> that their settings got lost after updating my application? I have >>> never had that problem testing my own app. But a lot of my users are >>> reporting that. (My application has 97.000 active installs and is >>> called "Missed Call") >>> >>> I'm looking forward reading your response. >>> >>> On Apr 24, 10:17 am, Dianne Hackborn wrote: >>> You really really should commit the data after you make each batch of changes, as the docs say. It is certainly very possible for the system to kill your process between onPause() and onStop() if it is under memory pressure. On Thu, Apr 23, 2009 at 9:56 AM, bo wrote: > I doSharedPreferences.Editor.commit() in couple of places. 1. > Immediately after setting the preference. 2. in Activity#onStop. > Nevertheless when I restart the app the preferences are gone. Any more > ideas? I do create prefs programmaticaly after harvesting these from > user (username/pwd) > > On Apr 21, 11:00 pm, Chander Pechetty wrote: > >> Sorry, I was referring to the settings created using >> PreferenceActivity screen using xml. Your actual preference values do >> not help much in diagnosing the issue. >> >> Example snippet from loadingpreferencesfrom xml: >> > android:title="pref1" >> android:summaryOn="SummaryOn" >> android:summaryOff="SummaryOff" >> android:defaultValue="true" >> android:persistent="true"/> >> >> Forpreferencescreated programatically, you can use >> Preference.setPersistent(true); >> >> If no Settings screen is present, and everything is through your >> program, then batchSharedPreferences.Editor.commit()'s should be >> fine. >> >> I had a similar problem as yours, but have not faced it again so far. >> Other than the known issue mentioned in the previous post, I don't >> know what else the problem could be unless you post your code >> perhaps... >> -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: SharedPreferences got deleted! - What could be the problem?
Yeah well it would be nice if we could find the problem. It is pretty annoying to have this problem using the basic SDK features. On Apr 24, 6:03 pm, bo wrote: > That's pretty much what I do also (why take any chances?). Now - all > that business with & gets me thinking. I'm actually storing some > snippets of unescaped HTML (which I actually don't care about much). I > think these I'll move to Bundle and see if my "real" preferences will > persist > > On Apr 24, 3:09 am, scanning_it wrote: > > > Thank you Dianne for joining the discussion. > > > I will look into my code again but I'm sure that this is the only way > > I am writting to theSharedPreferences: > > > settings.edit().putString(SOME_STRING, "Hello world.").commit(); > > > So there shouldn't be a problem with that one. > > > Is it possible thatSharedPreferencescould get lost when a background > > services writes to theSharedPreferencesfile and gets killed during > > that process? In my background service I am updating e.g. some shared > > prefs that tell me if I have set a specific notification or not. > > > Could this usage in services be a problem? > > > In addition it would be interesting why a lot of users are complaining > > that their settings got lost after updating my application? I have > > never had that problem testing my own app. But a lot of my users are > > reporting that. (My application has 97.000 active installs and is > > called "Missed Call") > > > I'm looking forward reading your response. > > > On Apr 24, 10:17 am, Dianne Hackborn wrote: > > > > You really really should commit the data after you make each batch of > > > changes, as the docs say. It is certainly very possible for the system to > > > kill your process between onPause() and onStop() if it is under memory > > > pressure. > > > > On Thu, Apr 23, 2009 at 9:56 AM, bo wrote: > > > > > I doSharedPreferences.Editor.commit() in couple of places. 1. > > > > Immediately after setting the preference. 2. in Activity#onStop. > > > > Nevertheless when I restart the app the preferences are gone. Any more > > > > ideas? I do create prefs programmaticaly after harvesting these from > > > > user (username/pwd) > > > > > On Apr 21, 11:00 pm, Chander Pechetty wrote: > > > > > Sorry, I was referring to the settings created using > > > > > PreferenceActivity screen using xml. Your actual preference values do > > > > > not help much in diagnosing the issue. > > > > > > Example snippet from loadingpreferencesfrom xml: > > > > > > > > > android:title="pref1" > > > > > android:summaryOn="SummaryOn" > > > > > android:summaryOff="SummaryOff" > > > > > android:defaultValue="true" > > > > > android:persistent="true"/> > > > > > > Forpreferencescreated programatically, you can use > > > > > Preference.setPersistent(true); > > > > > > If no Settings screen is present, and everything is through your > > > > > program, then batchSharedPreferences.Editor.commit()'s should be > > > > > fine. > > > > > > I had a similar problem as yours, but have not faced it again so far. > > > > > Other than the known issue mentioned in the previous post, I don't > > > > > know what else the problem could be unless you post your code > > > > > perhaps... > > > > -- > > > Dianne Hackborn > > > Android framework engineer > > > hack...@android.com > > > > Note: please don't send private questions to me, as I don't have time to > > > provide private support, and so won't reply to such e-mails. All such > > > questions should be posted on public forums, where I and others can see > > > and > > > answer them. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: SharedPreferences got deleted! - What could be the problem?
That's pretty much what I do also (why take any chances?). Now - all that business with & gets me thinking. I'm actually storing some snippets of unescaped HTML (which I actually don't care about much). I think these I'll move to Bundle and see if my "real" preferences will persist On Apr 24, 3:09 am, scanning_it wrote: > Thank you Dianne for joining the discussion. > > I will look into my code again but I'm sure that this is the only way > I am writting to the SharedPreferences: > > settings.edit().putString(SOME_STRING, "Hello world.").commit(); > > So there shouldn't be a problem with that one. > > Is it possible that SharedPreferences could get lost when a background > services writes to the SharedPreferences file and gets killed during > that process? In my background service I am updating e.g. some shared > prefs that tell me if I have set a specific notification or not. > > Could this usage in services be a problem? > > In addition it would be interesting why a lot of users are complaining > that their settings got lost after updating my application? I have > never had that problem testing my own app. But a lot of my users are > reporting that. (My application has 97.000 active installs and is > called "Missed Call") > > I'm looking forward reading your response. > > On Apr 24, 10:17 am, Dianne Hackborn wrote: > > > You really really should commit the data after you make each batch of > > changes, as the docs say. It is certainly very possible for the system to > > kill your process between onPause() and onStop() if it is under memory > > pressure. > > > On Thu, Apr 23, 2009 at 9:56 AM, bo wrote: > > > > I do SharedPreferences.Editor.commit() in couple of places. 1. > > > Immediately after setting the preference. 2. in Activity#onStop. > > > Nevertheless when I restart the app the preferences are gone. Any more > > > ideas? I do create prefs programmaticaly after harvesting these from > > > user (username/pwd) > > > > On Apr 21, 11:00 pm, Chander Pechetty wrote: > > > > Sorry, I was referring to the settings created using > > > > PreferenceActivity screen using xml. Your actual preference values do > > > > not help much in diagnosing the issue. > > > > > Example snippet from loadingpreferencesfrom xml: > > > > > > > android:title="pref1" > > > > android:summaryOn="SummaryOn" > > > > android:summaryOff="SummaryOff" > > > > android:defaultValue="true" > > > > android:persistent="true"/> > > > > > Forpreferencescreated programatically, you can use > > > > Preference.setPersistent(true); > > > > > If no Settings screen is present, and everything is through your > > > > program, then batch SharedPreferences.Editor.commit()'s should be > > > > fine. > > > > > I had a similar problem as yours, but have not faced it again so far. > > > > Other than the known issue mentioned in the previous post, I don't > > > > know what else the problem could be unless you post your code > > > > perhaps... > > > -- > > Dianne Hackborn > > Android framework engineer > > hack...@android.com > > > Note: please don't send private questions to me, as I don't have time to > > provide private support, and so won't reply to such e-mails. All such > > questions should be posted on public forums, where I and others can see and > > answer them. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: SharedPreferences got deleted! - What could be the problem?
Thank you Dianne for joining the discussion. I will look into my code again but I'm sure that this is the only way I am writting to the SharedPreferences: settings.edit().putString(SOME_STRING, "Hello world.").commit(); So there shouldn't be a problem with that one. Is it possible that SharedPreferences could get lost when a background services writes to the SharedPreferences file and gets killed during that process? In my background service I am updating e.g. some shared prefs that tell me if I have set a specific notification or not. Could this usage in services be a problem? In addition it would be interesting why a lot of users are complaining that their settings got lost after updating my application? I have never had that problem testing my own app. But a lot of my users are reporting that. (My application has 97.000 active installs and is called "Missed Call") I'm looking forward reading your response. On Apr 24, 10:17 am, Dianne Hackborn wrote: > You really really should commit the data after you make each batch of > changes, as the docs say. It is certainly very possible for the system to > kill your process between onPause() and onStop() if it is under memory > pressure. > > > > On Thu, Apr 23, 2009 at 9:56 AM, bo wrote: > > > I do SharedPreferences.Editor.commit() in couple of places. 1. > > Immediately after setting the preference. 2. in Activity#onStop. > > Nevertheless when I restart the app the preferences are gone. Any more > > ideas? I do create prefs programmaticaly after harvesting these from > > user (username/pwd) > > > On Apr 21, 11:00 pm, Chander Pechetty wrote: > > > Sorry, I was referring to the settings created using > > > PreferenceActivity screen using xml. Your actual preference values do > > > not help much in diagnosing the issue. > > > > Example snippet from loadingpreferencesfrom xml: > > > > > android:title="pref1" > > > android:summaryOn="SummaryOn" > > > android:summaryOff="SummaryOff" > > > android:defaultValue="true" > > > android:persistent="true"/> > > > > Forpreferencescreated programatically, you can use > > > Preference.setPersistent(true); > > > > If no Settings screen is present, and everything is through your > > > program, then batch SharedPreferences.Editor.commit()'s should be > > > fine. > > > > I had a similar problem as yours, but have not faced it again so far. > > > Other than the known issue mentioned in the previous post, I don't > > > know what else the problem could be unless you post your code > > > perhaps... > > -- > Dianne Hackborn > Android framework engineer > hack...@android.com > > Note: please don't send private questions to me, as I don't have time to > provide private support, and so won't reply to such e-mails. All such > questions should be posted on public forums, where I and others can see and > answer them. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: SharedPreferences got deleted! - What could be the problem?
You really really should commit the data after you make each batch of changes, as the docs say. It is certainly very possible for the system to kill your process between onPause() and onStop() if it is under memory pressure. On Thu, Apr 23, 2009 at 9:56 AM, bo wrote: > > I do SharedPreferences.Editor.commit() in couple of places. 1. > Immediately after setting the preference. 2. in Activity#onStop. > Nevertheless when I restart the app the preferences are gone. Any more > ideas? I do create prefs programmaticaly after harvesting these from > user (username/pwd) > > On Apr 21, 11:00 pm, Chander Pechetty wrote: > > Sorry, I was referring to the settings created using > > PreferenceActivity screen using xml. Your actual preference values do > > not help much in diagnosing the issue. > > > > Example snippet from loadingpreferencesfrom xml: > > > android:title="pref1" > > android:summaryOn="SummaryOn" > > android:summaryOff="SummaryOff" > > android:defaultValue="true" > > android:persistent="true"/> > > > > Forpreferencescreated programatically, you can use > > Preference.setPersistent(true); > > > > If no Settings screen is present, and everything is through your > > program, then batch SharedPreferences.Editor.commit()'s should be > > fine. > > > > I had a similar problem as yours, but have not faced it again so far. > > Other than the known issue mentioned in the previous post, I don't > > know what else the problem could be unless you post your code > > perhaps... > > > -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: SharedPreferences got deleted! - What could be the problem?
These reports don't sound good at all. I'm just wondering why some developers don't have any problems at all. On Apr 23, 10:36 pm, "nEx.Software" wrote: > I was having this issue but couldn't figure it out. Now, I store all > of my settings in the SQLiteDatabase I use for the rest of the > Application. I don't even touch theSharedPreferencesfor fear of > losing the Preferences altogether. > > On Apr 23, 1:27 pm, Mattaku Betsujin > wrote: > > > I also saw the prefs being lost ocassionally, especially after update or > > reinstall. I haven't seen it happen (yet) after quoting, but maybe that's > > just luck. > > > I will also add a call to setPersistent to my app see if that helps. > > > On Thu, Apr 23, 2009 at 1:12 PM, scanning_it > > wrote: > > > > Thank you for your responses. By the way I love Nubinews. :) > > > > It is a known bug that & signs lead to a loss of shared prefs. But my > > > settings don't include these signs. :( I have only the following > > > things included as strings: > > > > content://media/internal/audio/media/33 > > > 100,200,300,400 > > > > So this can't be the problem with my settings loss. :( I will try > > > using to quote the strings right now and I hope to fix the problems > > > with that. My problem ist that I can't reproduce the bug on a daily > > > basis. Often it works with the same settings for weeks and suddenly > > > the prefs are gone. > > > > On Apr 23, 7:09 pm, Mattaku Betsujin > > > wrote: > > > > I found that the preferences XML will break very easily if you store > > > > some > > > > Strings containing 'special' characters. I am not sure what exactly > > > > those > > > > are, but when I stored things like > > > > > putString("someurl", "http://xyz/?a=b&c=d";) > > > > > the preference file becomes empty next time I try to open it. > > > > > My solution is to quote all Strings that I put into the > > >SharedPreferences. > > > > After that my problems seems to go away. > > > > > I couldn't find a Base64 encoder in the Android API, so I wrote a > > > > quick-and-dirty PrefQuote class: > > > > >http://code.google.com/p/nubi/source/browse/trunk/android/nubinews/sr... > > > > > putString("someurl", PrefQuote.quote("http://xyz/?a=b";)) > > > > > Hope this helps > > > > > On Thu, Apr 23, 2009 at 9:56 AM, bo wrote: > > > > > > I doSharedPreferences.Editor.commit() in couple of places. 1. > > > > > Immediately after setting the preference. 2. in Activity#onStop. > > > > > Nevertheless when I restart the app the preferences are gone. Any more > > > > > ideas? I do create prefs programmaticaly after harvesting these from > > > > > user (username/pwd) > > > > > > On Apr 21, 11:00 pm, Chander Pechetty wrote: > > > > > > Sorry, I was referring to the settings created using > > > > > > PreferenceActivity screen using xml. Your actual preference values > > > > > > do > > > > > > not help much in diagnosing the issue. > > > > > > > Example snippet from loadingpreferencesfrom xml: > > > > > > > > > > > android:title="pref1" > > > > > > android:summaryOn="SummaryOn" > > > > > > android:summaryOff="SummaryOff" > > > > > > android:defaultValue="true" > > > > > > android:persistent="true"/> > > > > > > > Forpreferencescreated programatically, you can use > > > > > > Preference.setPersistent(true); > > > > > > > If no Settings screen is present, and everything is through your > > > > > > program, then batchSharedPreferences.Editor.commit()'s should be > > > > > > fine. > > > > > > > I had a similar problem as yours, but have not faced it again so > > > > > > far. > > > > > > Other than the known issue mentioned in the previous post, I don't > > > > > > know what else the problem could be unless you post your code > > > > > > perhaps... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: SharedPreferences got deleted! - What could be the problem?
I was having this issue but couldn't figure it out. Now, I store all of my settings in the SQLiteDatabase I use for the rest of the Application. I don't even touch the SharedPreferences for fear of losing the Preferences altogether. On Apr 23, 1:27 pm, Mattaku Betsujin wrote: > I also saw the prefs being lost ocassionally, especially after update or > reinstall. I haven't seen it happen (yet) after quoting, but maybe that's > just luck. > > I will also add a call to setPersistent to my app see if that helps. > > On Thu, Apr 23, 2009 at 1:12 PM, scanning_it > wrote: > > > > > Thank you for your responses. By the way I love Nubinews. :) > > > It is a known bug that & signs lead to a loss of shared prefs. But my > > settings don't include these signs. :( I have only the following > > things included as strings: > > > content://media/internal/audio/media/33 > > 100,200,300,400 > > > So this can't be the problem with my settings loss. :( I will try > > using to quote the strings right now and I hope to fix the problems > > with that. My problem ist that I can't reproduce the bug on a daily > > basis. Often it works with the same settings for weeks and suddenly > > the prefs are gone. > > > On Apr 23, 7:09 pm, Mattaku Betsujin > > wrote: > > > I found that the preferences XML will break very easily if you store some > > > Strings containing 'special' characters. I am not sure what exactly those > > > are, but when I stored things like > > > > putString("someurl", "http://xyz/?a=b&c=d";) > > > > the preference file becomes empty next time I try to open it. > > > > My solution is to quote all Strings that I put into the > > SharedPreferences. > > > After that my problems seems to go away. > > > > I couldn't find a Base64 encoder in the Android API, so I wrote a > > > quick-and-dirty PrefQuote class: > > > >http://code.google.com/p/nubi/source/browse/trunk/android/nubinews/sr... > > > > putString("someurl", PrefQuote.quote("http://xyz/?a=b";)) > > > > Hope this helps > > > > On Thu, Apr 23, 2009 at 9:56 AM, bo wrote: > > > > > I do SharedPreferences.Editor.commit() in couple of places. 1. > > > > Immediately after setting the preference. 2. in Activity#onStop. > > > > Nevertheless when I restart the app the preferences are gone. Any more > > > > ideas? I do create prefs programmaticaly after harvesting these from > > > > user (username/pwd) > > > > > On Apr 21, 11:00 pm, Chander Pechetty wrote: > > > > > Sorry, I was referring to the settings created using > > > > > PreferenceActivity screen using xml. Your actual preference values do > > > > > not help much in diagnosing the issue. > > > > > > Example snippet from loadingpreferencesfrom xml: > > > > > > > > > android:title="pref1" > > > > > android:summaryOn="SummaryOn" > > > > > android:summaryOff="SummaryOff" > > > > > android:defaultValue="true" > > > > > android:persistent="true"/> > > > > > > Forpreferencescreated programatically, you can use > > > > > Preference.setPersistent(true); > > > > > > If no Settings screen is present, and everything is through your > > > > > program, then batch SharedPreferences.Editor.commit()'s should be > > > > > fine. > > > > > > I had a similar problem as yours, but have not faced it again so far. > > > > > Other than the known issue mentioned in the previous post, I don't > > > > > know what else the problem could be unless you post your code > > > > > perhaps... > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: SharedPreferences got deleted! - What could be the problem?
I also saw the prefs being lost ocassionally, especially after update or reinstall. I haven't seen it happen (yet) after quoting, but maybe that's just luck. I will also add a call to setPersistent to my app see if that helps. On Thu, Apr 23, 2009 at 1:12 PM, scanning_it wrote: > > Thank you for your responses. By the way I love Nubinews. :) > > It is a known bug that & signs lead to a loss of shared prefs. But my > settings don't include these signs. :( I have only the following > things included as strings: > > content://media/internal/audio/media/33 > 100,200,300,400 > > So this can't be the problem with my settings loss. :( I will try > using to quote the strings right now and I hope to fix the problems > with that. My problem ist that I can't reproduce the bug on a daily > basis. Often it works with the same settings for weeks and suddenly > the prefs are gone. > > > > On Apr 23, 7:09 pm, Mattaku Betsujin > wrote: > > I found that the preferences XML will break very easily if you store some > > Strings containing 'special' characters. I am not sure what exactly those > > are, but when I stored things like > > > > putString("someurl", "http://xyz/?a=b&c=d";) > > > > the preference file becomes empty next time I try to open it. > > > > My solution is to quote all Strings that I put into the > SharedPreferences. > > After that my problems seems to go away. > > > > I couldn't find a Base64 encoder in the Android API, so I wrote a > > quick-and-dirty PrefQuote class: > > > > http://code.google.com/p/nubi/source/browse/trunk/android/nubinews/sr... > > > > putString("someurl", PrefQuote.quote("http://xyz/?a=b";)) > > > > Hope this helps > > > > On Thu, Apr 23, 2009 at 9:56 AM, bo wrote: > > > > > I do SharedPreferences.Editor.commit() in couple of places. 1. > > > Immediately after setting the preference. 2. in Activity#onStop. > > > Nevertheless when I restart the app the preferences are gone. Any more > > > ideas? I do create prefs programmaticaly after harvesting these from > > > user (username/pwd) > > > > > On Apr 21, 11:00 pm, Chander Pechetty wrote: > > > > Sorry, I was referring to the settings created using > > > > PreferenceActivity screen using xml. Your actual preference values do > > > > not help much in diagnosing the issue. > > > > > > Example snippet from loadingpreferencesfrom xml: > > > > > > > android:title="pref1" > > > > android:summaryOn="SummaryOn" > > > > android:summaryOff="SummaryOff" > > > > android:defaultValue="true" > > > > android:persistent="true"/> > > > > > > Forpreferencescreated programatically, you can use > > > > Preference.setPersistent(true); > > > > > > If no Settings screen is present, and everything is through your > > > > program, then batch SharedPreferences.Editor.commit()'s should be > > > > fine. > > > > > > I had a similar problem as yours, but have not faced it again so far. > > > > Other than the known issue mentioned in the previous post, I don't > > > > know what else the problem could be unless you post your code > > > > perhaps... > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: SharedPreferences got deleted! - What could be the problem?
Thank you for your responses. By the way I love Nubinews. :) It is a known bug that & signs lead to a loss of shared prefs. But my settings don't include these signs. :( I have only the following things included as strings: content://media/internal/audio/media/33 100,200,300,400 So this can't be the problem with my settings loss. :( I will try using to quote the strings right now and I hope to fix the problems with that. My problem ist that I can't reproduce the bug on a daily basis. Often it works with the same settings for weeks and suddenly the prefs are gone. On Apr 23, 7:09 pm, Mattaku Betsujin wrote: > I found that the preferences XML will break very easily if you store some > Strings containing 'special' characters. I am not sure what exactly those > are, but when I stored things like > > putString("someurl", "http://xyz/?a=b&c=d";) > > the preference file becomes empty next time I try to open it. > > My solution is to quote all Strings that I put into the SharedPreferences. > After that my problems seems to go away. > > I couldn't find a Base64 encoder in the Android API, so I wrote a > quick-and-dirty PrefQuote class: > > http://code.google.com/p/nubi/source/browse/trunk/android/nubinews/sr... > > putString("someurl", PrefQuote.quote("http://xyz/?a=b";)) > > Hope this helps > > On Thu, Apr 23, 2009 at 9:56 AM, bo wrote: > > > I do SharedPreferences.Editor.commit() in couple of places. 1. > > Immediately after setting the preference. 2. in Activity#onStop. > > Nevertheless when I restart the app the preferences are gone. Any more > > ideas? I do create prefs programmaticaly after harvesting these from > > user (username/pwd) > > > On Apr 21, 11:00 pm, Chander Pechetty wrote: > > > Sorry, I was referring to the settings created using > > > PreferenceActivity screen using xml. Your actual preference values do > > > not help much in diagnosing the issue. > > > > Example snippet from loadingpreferencesfrom xml: > > > > > android:title="pref1" > > > android:summaryOn="SummaryOn" > > > android:summaryOff="SummaryOff" > > > android:defaultValue="true" > > > android:persistent="true"/> > > > > Forpreferencescreated programatically, you can use > > > Preference.setPersistent(true); > > > > If no Settings screen is present, and everything is through your > > > program, then batch SharedPreferences.Editor.commit()'s should be > > > fine. > > > > I had a similar problem as yours, but have not faced it again so far. > > > Other than the known issue mentioned in the previous post, I don't > > > know what else the problem could be unless you post your code > > > perhaps... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: SharedPreferences got deleted! - What could be the problem?
I found that the preferences XML will break very easily if you store some Strings containing 'special' characters. I am not sure what exactly those are, but when I stored things like putString("someurl", "http://xyz/?a=b&c=d";) the preference file becomes empty next time I try to open it. My solution is to quote all Strings that I put into the SharedPreferences. After that my problems seems to go away. I couldn't find a Base64 encoder in the Android API, so I wrote a quick-and-dirty PrefQuote class: http://code.google.com/p/nubi/source/browse/trunk/android/nubinews/src/com/nubinews/reader/PrefQuote.java putString("someurl", PrefQuote.quote("http://xyz/?a=b";)) Hope this helps On Thu, Apr 23, 2009 at 9:56 AM, bo wrote: > > I do SharedPreferences.Editor.commit() in couple of places. 1. > Immediately after setting the preference. 2. in Activity#onStop. > Nevertheless when I restart the app the preferences are gone. Any more > ideas? I do create prefs programmaticaly after harvesting these from > user (username/pwd) > > On Apr 21, 11:00 pm, Chander Pechetty wrote: > > Sorry, I was referring to the settings created using > > PreferenceActivity screen using xml. Your actual preference values do > > not help much in diagnosing the issue. > > > > Example snippet from loadingpreferencesfrom xml: > > > android:title="pref1" > > android:summaryOn="SummaryOn" > > android:summaryOff="SummaryOff" > > android:defaultValue="true" > > android:persistent="true"/> > > > > Forpreferencescreated programatically, you can use > > Preference.setPersistent(true); > > > > If no Settings screen is present, and everything is through your > > program, then batch SharedPreferences.Editor.commit()'s should be > > fine. > > > > I had a similar problem as yours, but have not faced it again so far. > > Other than the known issue mentioned in the previous post, I don't > > know what else the problem could be unless you post your code > > perhaps... > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: SharedPreferences got deleted! - What could be the problem?
I do SharedPreferences.Editor.commit() in couple of places. 1. Immediately after setting the preference. 2. in Activity#onStop. Nevertheless when I restart the app the preferences are gone. Any more ideas? I do create prefs programmaticaly after harvesting these from user (username/pwd) On Apr 21, 11:00 pm, Chander Pechetty wrote: > Sorry, I was referring to the settings created using > PreferenceActivity screen using xml. Your actual preference values do > not help much in diagnosing the issue. > > Example snippet from loadingpreferencesfrom xml: > android:title="pref1" > android:summaryOn="SummaryOn" > android:summaryOff="SummaryOff" > android:defaultValue="true" > android:persistent="true"/> > > Forpreferencescreated programatically, you can use > Preference.setPersistent(true); > > If no Settings screen is present, and everything is through your > program, then batch SharedPreferences.Editor.commit()'s should be > fine. > > I had a similar problem as yours, but have not faced it again so far. > Other than the known issue mentioned in the previous post, I don't > know what else the problem could be unless you post your code > perhaps... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: SharedPreferences got deleted! - What could be the problem?
Thank you for your response. I'm using the settings the following way. http://paste.pocoo.org/show/kFnfBNWMlsWLS0TWuzlO/ I'm saving only Strings that can get the following values: - content://media/internal/audio/media/33 - 100,200,300 In addtion I'm having int values and boolean ones. The users don't set any String values by their own which could lead to the above mentioned encoding errors. (I had this error ones but fixed it) So to be honest I don't really know what could cause the settings loss. Especially after a reboot some users are reporting this kind of failure. On Apr 22, 8:00 am, Chander Pechetty wrote: > Sorry, I was referring to the settings created using > PreferenceActivity screen using xml. Your actual preference values do > not help much in diagnosing the issue. > > Example snippet from loading preferences from xml: > android:title="pref1" > android:summaryOn="SummaryOn" > android:summaryOff="SummaryOff" > android:defaultValue="true" > android:persistent="true"/> > > For preferences created programatically, you can use > Preference.setPersistent(true); > > If no Settings screen is present, and everything is through your > program, then batchSharedPreferences.Editor.commit()'s should be > fine. > > I had a similar problem as yours, but have not faced it again so far. > Other than the known issue mentioned in the previous post, I don't > know what else the problem could be unless you post your code > perhaps... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: SharedPreferences got deleted! - What could be the problem?
Sorry, I was referring to the settings created using PreferenceActivity screen using xml. Your actual preference values do not help much in diagnosing the issue. Example snippet from loading preferences from xml: For preferences created programatically, you can use Preference.setPersistent(true); If no Settings screen is present, and everything is through your program, then batch SharedPreferences.Editor.commit()'s should be fine. I had a similar problem as yours, but have not faced it again so far. Other than the known issue mentioned in the previous post, I don't know what else the problem could be unless you post your code perhaps... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: SharedPreferences got deleted! - What could be the problem?
Well here are the things that can be as a maximum in my settings file: http://paste.pocoo.org/show/lqqABv2lblNz1Bkh9XNs/ It would be nice if you could tell me if this is ok. Where should I use this one "use android:persistent="true"" ? Regards. On Apr 21, 5:39 pm, Chander Pechetty wrote: > Are these settings part of your preferences xml file? > use android:persistent="true" or set it and you most likely won't have > this issue. > > Check if your case falls under the issue > :http://code.google.com/p/android/issues/detail?id=1707 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: SharedPreferences got deleted! - What could be the problem?
Are these settings part of your preferences xml file? use android:persistent="true" or set it and you most likely won't have this issue. Check if your case falls under the issue : http://code.google.com/p/android/issues/detail?id=1707 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: SharedPreferences got deleted! - What could be the problem?
Thank you for the answer. Could you specifiy where I can find this bug in the issue list? Regards On Mar 6, 12:37 am, JP wrote: > This is a known issue. I worked around it by storing a copy of the > preferences in a sqlite database table, and populate the preferences > form the database in case the regular preferences arelost. A pain, > but in my experience has worked. > > On Mar 5, 12:46 pm, code_android_festival_way > > wrote: > > Hello. > > > At the moment I got a bug issue with my application. I have saved > > about 20 values in the SharedPreferences. I got a lot of users > > reporting that theirsettingsgot reset without uninstalling the > > application. To be honest I didn't believe these reports since today. > > After 4 days of usage thesettingshad been gone from one moment to > > the other. > > > I can't find an error in my application. The only possibility that > > could delete thesettingswould be "me" (as the coder) calling "clear > > ().commit()" on thesettings. But I don't use that at all. > > > To be honest I don't know where to start searching since it works for > > an unregular amount of time and then thesettingsfile is empty. > > > Some facts about the point of time mysettingsgot deleted: > > - clear() can't have been called (it is not implemented in my app) > > - I got more than 30 MB free space on the internal flash memory > > - I have NOT uninstalled the app > > - I have NOT done any OTA update > > - I have NOT rebooted the phone > > - I have changed the thread priority of some background threads in my > > service in my last update. (that was the only change and since that > > more users report that "bug") > > - My application does NOT use multiple processes > > > It would be awesome if I could get some hints why this could happen. I > > got a big "adb bugreport" here but can't find anything strange. > > > Regards --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: SharedPreferences got deleted! - What could be the problem?
This is a known issue. I worked around it by storing a copy of the preferences in a sqlite database table, and populate the preferences form the database in case the regular preferences are lost. A pain, but in my experience has worked. On Mar 5, 12:46 pm, code_android_festival_way wrote: > Hello. > > At the moment I got a bug issue with my application. I have saved > about 20 values in the SharedPreferences. I got a lot of users > reporting that their settings got reset without uninstalling the > application. To be honest I didn't believe these reports since today. > After 4 days of usage the settings had been gone from one moment to > the other. > > I can't find an error in my application. The only possibility that > could delete the settings would be "me" (as the coder) calling "clear > ().commit()" on the settings. But I don't use that at all. > > To be honest I don't know where to start searching since it works for > an unregular amount of time and then the settings file is empty. > > Some facts about the point of time my settings got deleted: > - clear() can't have been called (it is not implemented in my app) > - I got more than 30 MB free space on the internal flash memory > - I have NOT uninstalled the app > - I have NOT done any OTA update > - I have NOT rebooted the phone > - I have changed the thread priority of some background threads in my > service in my last update. (that was the only change and since that > more users report that "bug") > - My application does NOT use multiple processes > > It would be awesome if I could get some hints why this could happen. I > got a big "adb bugreport" here but can't find anything strange. > > Regards --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---