Step: 1. Create the arrays. xml file under res/values. The content is as follows: <? Xml version = "1.0" encoding = "UTF-8"?> <Resources> <string-array name = "testStringArray"> <item> hello1 </item> <item> hello2 </item> <item> hello3 </item> <item> hello4 </item> </string-array> <integer-array name = "testIntegerArray"> <item> 1 </item> <item> 2 </item> <item> 3 </item> <item> 4 </item> </integer-array> </resources> 2. Call resources in MainActivity and traverse the array, the content is as follows: package cn.com. bravesoft; import android. app. activity; import android. OS. bundle; public class TestArray extends Activity {@ Override public void onCreate (Bundle savedInstanceState) {super. onCreate (savedInstanceState); setContentView (R. layout. main); // obtain the array String stringsArray [] = this. getResources (). getStringArray (R. array. testStringArray); int ingegersArray [] = this. getResources (). getIntArray (R. array. testIntegerArray); // traverses the array for (int I = 0; I <stringsArray. length; I ++) {System. out. println ("XXXXX stringsArray [I] =" + stringsArray [I]);} for (int I = 0; I <ingegersArray. length; I ++) {System. out. println ("XXXXX ingegersArray [I] =" + ingegersArray [I]) ;}}