How to get xml file from drawable folder Android


I have an xml file on a web page on my application I use

static final String URL = "";
String xml = parser.getXmlFromUrl(URL);

works fine but know I have put this file in my Android resource folder. So how do I get my file from android drawable folder like this instead of web page.


Put the xml into /res/raw folder.

Then use :

InputStream is=getResources().openRawResource(R.raw.my_xml);

Then use this parser XML PULL PARSER

XmlPullParser xpp=XmlPullParserFactory.newInstance().newPullParser();


Answered By – Pratik Sharma

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published