How can I parse my local XML file located in my android project (inside res/XML folder) and want to get the values in that file.
+3
A:
To access XML resources stored in res/xml
, call getResources().getXml()
from any Activity
or other Context
. You need to supply to getXml()
the ID of the XML to load (R.xml.myfile
).
CommonsWare
2009-09-03 11:09:17
The getXml() method automatically returns you an XmlResourceParser implementation instance, so you can directly pass it to XmlPullParser and start parsing your data.
Dimitar Dimitrov
2009-09-03 11:50:22