getResourceEntryName for an array item

浪子不回头ぞ 提交于 2019-12-02 09:25:57

As this is an xml, you will need a xml parser. Then you can get the values of name using

attributes.getValue("name");

Or

name = ((Element) your_node).getAttribute("name"));
using DOM parser (org.w3c.dom)

Another solution:

Resources res = getResources();
TypedArray entriesTypedArray = res.obtainTypedArray(R.array.spinerArray);
ArrayList entriesName = new ArrayList();
TypedValue v1 = new TypedValue();
for (int i1=0; i1<entriesTypedArray.length(); i1++) {
    entriesTypedArray.getValue(i1, v1);
    String name1 = res.getResourceEntryName(v1.resourceId);
    entriesName.add(name1);
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!