我有一个XML文件:
<?xml version="1.0" encoding="UTF-8"?>
<locations>
<location index="0" asset="@drawable/test1"></location>
</locations>
当我解析XML并尝试检索ResourceID时,它没有返回。
int ResourceID = xmlParser.getAttributeIntValue(null, "asset", 0);
所有 XML 中的其他值都被成功检索...我做错了什么?
编辑:我弄清楚了,我不想只获取一个整数。
而是使用
int ResourceID = xmlParser.getAttributeIntValue(null, "asset", 0);
it's
int ResourceID = xmlParser.getAttributeResourceValue(null, "asset", 0);