Hi
I have been trying to fix this problem for 3 days now and still no
luck. I am trying to save some preferences of my app (just a few
integers and strings), but I notice that SharedPreferences never
creates any xml file. So far I have tried the followings:
1) In my AndroidManifest, I set Persistent to true.
2) To be more cautious, my preference file is all lower case, even
though I did not think it was necessary.
3) Interestingly enough edit().commit() returns true, but I do not see
the xml file anywhere in my computer. And when I try to read the
values from the preferences, I get the default values that I have in
my getInt() or getString().
4) I ran my app in the debugger and I saw no errors in the log related
to this.
5) I tried running it in 2 different emulator running Android 1.5 and
2.0, same result.
Here is a gist of my code:
SharePreferences x = this.getSharedPreferences
(Configuration.PREFFILE, Context.MODE_PRIVATE);
int level = x.getInt(LEVEL, 1);
..
x.edit().putInt(LEVEL, level);
if ( !x.edit().commit() )
Log.e(Configuration.TAG, setLevel failed to commit);
I can not think of any reason that causes this. Any help is greatly
appreciated.
Thanks
--
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