Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

String Array for string.xml android [duplicate]

Tags:

android

I'm doing some age calculation using spinner. I've added string array to it. In my string array in string.xml, I key in the value

 <string-array name="arrayAge">
        <item> < 40 </item>
        <item> >=40 </item>

    </string-array>

However, I met with error at <40. Can anyone tell me how should I format it, if I want to display <40?

like image 977
userNoIdea Avatar asked Jan 17 '26 21:01

userNoIdea


1 Answers

You need to use &lt; if you want to display < character. The reason for it is that in XML, < is the beginning of the closing tag and the parser wouldn't know how to distinguish that.

To display >, use &gt;.

like image 186
Szymon Avatar answered Jan 19 '26 18:01

Szymon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!