I want to enter string " -< " in strings.xml file in eclipse, the string has character < and I couldn’t add it to xml file without error! I even tried to escaping by \ character:
<string name="search_target_arrow"> -\< </string>
or enclosing it between "" as below:
<string name="search_target_arrow">" -< "</string>
but none worked. Then finally with help of kind users here I found that this would be the correct way to enter such chars in xml:
<string name="search_target_arrow"> -&lt; </string>
but now when I get this resource in my code:
getResources().getString(R.string.search_target_arrow);
and set it to a TextView, It shows -< on screen! How to get original character by code? should I do something related to HTML?!
If you are using eclipse then right click on strings.xml & open it with “Android Common XML Editor” & add from there it will handle escaping for you.