English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
In Android, use string-Array is a simple method to extract data from XML resource files.
For example:
Place the corresponding data in the arrays.xml file in the values folder
<?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 = res.getStringArray(R.array.city);
You can get the string-All item data under array name="city" is a simple and convenient method.
That is all for the Android string-Material compilation of array, will continue to supplement relevant materials later, thank you all for your support to this station!
Statement: The content of this article is from the Internet, and the copyright belongs to the original author. The content is contributed and uploaded by Internet users spontaneously, and the website does not own the copyright. The website does not edit the content manually and does not bear relevant legal responsibilities. If you find any content suspected of copyright infringement, please send an email to: notice#w3Please replace # with @ when sending an email to report abuse. Provide relevant evidence, and once verified, the website will immediately delete the suspected infringing content.