SharedPreferences bug when writing strings with ampersands in them

by » Sat, 07 Mar 2009 10:54:16 GMT

Sponsored Links
 Hi All,

I've just tracked down a weird bug in our app where SharedPreferences
were failing between power cycles of the phone.

It turns out that one of the strings we were saving had an "&" in it.
When I look at the xml that is being persisted I see that this is
being encoded as && instead of just &

This means that when you come to read the settings back you don't get
any values at all.

Is this a known issue? I see lots of posts about preferences
dissappearing, but nothing about this.



SharedPreferences bug when writing strings with ampersands in them

by Mark Murphy » Sat, 07 Mar 2009 23:09:14 GMT


Well, you posted an issue, so it's known now!


However, if you could attach some sample code to that issue that
demonstrates the bug, that may help get it resolved more quickly.

Mark Murphy (a Commons Guy) 
_The Busy Coder's Guide to Android Development_ Version 2.0 Published!


Sponsored Links

Other Threads

1. timeout for HistoryRecord


Some times when i start my activity from, i am not able see my
activity on screen(I am able see a black screen and a status bar).
While facing this problem i found "Activity idle/pause timeout for
HistoryRecord{..." message in the logcat.

Can anybody help me how to handle the above situation.



2. how to draw multiple lines in Edittext

any help?


3. ServiceConnectionLeaked Error

4. Custom multiselect dialog

5. To make the listed items clickable

6. Make the Video size play in full screen (stretch to fit width and height)

7. WPA-EAP support in Android