How to declare String array in strings.xml resource file

Waqas Anwar
23 July 2011
7553 Views

You can declare String array in strings.xml resource file using the string-array element as shown in the code below. You also need to give name using the name attribute. This name can be used to access the array in layout files and also pragmatically in code.

<string-array name="priority">
   <item>None</item>
   <item>Low</item>
   <item>Medium</item>
   <item>High</item>       
</string-array>