SharedPreferences bug when writing strings with ampersands in them

by cmgreen...@googlemail.com » 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.

Cheers
Chris.

--~--~---------~--~----~------------~-------~--~----~



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)
 http://commonsware.com 
_The Busy Coder's Guide to Android Development_ Version 2.0 Published!

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. Circular Scroll

Hi,

I'm new to android and I'd need some help.
I'm currently trying to implement  a circular scrolling in my
Activity.
I'd like to have the available items disposed on a circle and I would
like to be able to rotate them so that the clickable item is going to
be the one on the top of the circle.

Is there any native API that will allow me to do this?
Which classes should I use?

Thanks in advance for your help.

Cheers

Francesco

--~--~---------~--~----~------------~-------~--~----~

2. android.permission.CALL_PRIVILEGED not working

I'm playing around with the SDK and looking at creating a new dialer
application.

One of the things I'd like to be able  to do is be able to dial 911 as
I thought it might be useful ;-)

I thought all I'd have to do is add

<uses-permission android:name="android.permission.CALL_PRIVILEGED"></
uses-permission>

To my manifest so that when I invoke:

startActivity(new Intent("android.intent.action.CALL",
                       Uri.parse("tel:911")));

It would go through. As it is now when I press my test button nothing
happens at all no error msg...no dialing.  All other numbers I've
tried seem to work.

What am I doing wrong?

Thanks

C.

--~--~---------~--~----~------------~-------~--~----~

3. Contacts.Phones.getDisplayName

4. Motorolas job posting

5. nullPointer/thread error when reading contacts

6. Contacts DataBase

7. Android Filesytem loading error on i.mx31 platform