Android File Path NOT Found -
I am trying to XML parsing program. I put the XML file under FileInputStream is also used I Android Asset Folder, Miattia-INF folder of your XML file is given. This is the reason that the file name is "container.xml".
Here is my code parseXML,
public FileNotFoundException zero parseXMLinfoBook (), ParserConfigurationException, SAXException {FileInputStream throws = new FileInputStream ( "file: /// android_asset / META -INF / container.xml "); Stringbuff inline = new stringbuffer (); InputStreamReader isr = new InputStreamReader (in); BufferedReader inRd = new BufferedReader (ISR); SAXParserFactory spf = SAXParserFactory.newInstance (); SAXParser spr = spf.newSAXParser (); XMLReader xmlreader = spr.getXMLReader (); Xmlhander xmlhe = new xmlhandler (); Xmlreader.setContentHandler (xmlhe); }
Here is Button.SetonClick code,
View public void onClick (v) {// TODO Auto-generated method stub try {parseXMLinfoBook () ; } Hold (FileNotFoundException E) {// TODO Auto generated blocking block e.printStackTrace (); Tv.setText ("ErrorPath" + EZET Message ()); } Catch (ParserConfigurationException e) {// TODO Auto-generated catch block e.printStackTrace (); } Grip (SAXException E) {// TODO Automatic generated block e.printStackTrace (); }}});
Hope only I got the error message!
I think it kept its container.xml file property directory of your application inside APK's package is
To open files inside your Android app / assets directory, you need one. .. Your activity or service is available on the reference object and is therefore available
AssetManager MGR = getContext () getAssets (); In InputStream = mgr.open ("Meta-INF / container.exml"); InputStreamReader isr = new InputStreamReader (in); // ... rest code
Comments
Post a Comment