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. HTC Hero, missing applications from Market after firmware update

No, that isn't the case.  My apps just use the network permissions and
nothing else.  Also, why could I see the apps before my upgrade and now
after I cannot?  Again, I don't know who to point the finger to at this


2. Perkiraan droid

Guys ... Mau nanya :
1. Kira kira kapan droid beredar di indo ? Bm juga ngak masalah.

2. Brp harga perkiraan ?

Sent from my BlackBerry smartphone from Sinyal Bagus XL, Nyambung Teruuusss...!
Google Groups "Indonesian Android Community [id-android]" group.

To post to this group, send email to

To request to subscribe to this group:


3. methods not working (force closing), is there something wrong?

4. need some help with GUI

5. Bio wallet vs fire wallet

6. Read status bar notifications programmatically?

7. android.R.drawable.ic_menu_home - can not use