读书人

Android xml资料里读取string array

发布时间: 2012-08-14 10:39:57 作者: rapoo

Android xml文件里读取string array
example:XML file saved at res/values/strings.xml : <? xml version = "1.0" encoding = "utf-8" ?>

<resources>     <string-array name = "planets_array" >         <item> Mercury </item>         <item> Venus </item>         <item> Earth </item>         <item> Mars </item>     </string-array> </resources>


This application code retrieves a string array:

Resources res = getResources () ; String [] planets = res . getStringArray ( R . array . planets_array );

读书人网 >XML SOAP

热点推荐