SoFunction
Updated on 2025-04-09

Android string-array data source is simple to use

In Android, using string-array is a simple method to extract XML resource file data.

Examples are as follows:

Put the corresponding data into the values ​​folder file

<?xml version="1.0" encoding="utf-8"?>
<resources>
  <string-array name="city">
    <item>Xiamen City</item>
    <item>Fuzhou City</item>
    <item>Quanzhou City</item>
    <item>Zhangzhou City</item>
    <item>Longyan City</item>
  </string-array> 
</resources>  

Then in the Activity, use it directly

Resources res =getResources();
String[] city=();

You can obtain all item data under string-array name="city", a simple and convenient method.

The above is the information sorted out of Android string-array. We will continue to add relevant information in the future. Thank you for your support for this site!