Skip to content Skip to sidebar Skip to footer

Url In String Resource Xml

I have stored a couple of urls in strings.xml file. I want to store them without encoding them (as raw text), but strings.xml throws error for = and &. For example: http://www.

Solution 1:

You cannot use & directly, because XML document is expected to be well-formed and the problem is with & character itself. For XML/HTML you would have to use & entity (or &), but for URL use URL encoding and replace & it with %26 (as you did) which should simply work as browsers do understand such things as they simply have to.

Solution 2:

You could Base64 encode and decode your URL Strings with http://developer.android.com/reference/android/util/Base64.html

Post a Comment for "Url In String Resource Xml"