Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the best way to store and access XML in Android?

While I realize resources themselves are defined in XML files, if I have an XML file of my own type that I wish to use, should I be storing them in "res/xml"?

Is there a better way to do this such as using assets and then loading them as binary to be parsed by another XML library?

like image 884
Alexander Trauzzi Avatar asked Mar 07 '10 15:03

Alexander Trauzzi


1 Answers

I would go with adding the XML resource inside the res folder with the specific resource type. Its a convention that I have adapted to, having all my files in the same directory for organization.

If you add your XML file inside of res/xml it can be accessed anytime at run-time via Resources.getXML()

like image 86
Anthony Forloney Avatar answered Oct 05 '22 10:10

Anthony Forloney