Issue
I have an xml file on a web page http://api.androidhive.info/music/music.xml on my application I use
static final String URL = "http://api.androidhive.info/music/music.xml";
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 R.drawble.music.xml
instead of web page.
http://api.androidhive.info/music/music.xml
Solution
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();
xpp.setInput(is,"your-encoding");
Thanks.
Answered By - Pratik Sharma
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.