How to declare String array in strings.xml resource file


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>

 

 

About author


User avatar

Waqas Anwar

Founder of EzzyLearning.com, Senior Consultant, Microsoft .NET and Web Technologies

Comments