How to place "&" in xml strings file in android studio

Hucen Farhan picture Hucen Farhan · Oct 21, 2015 · Viewed 12.2k times · Source

I have my xml string file like this:

<string name="text1">ben & angie</string>

But it says I have an unescaped & . How to escape it?

Answer

wero picture wero · Oct 21, 2015

Write:

<string name="text1">ben &amp; angie</string>

Here is a link to the xml spec how to escape characters.