Wednesday, April 25, 2012

Android SAX parsing retrieval very slow

In my app i have some 50 to 100 data to be parsed...also some images within 2 MB size...All these are to be retrieved to a single activity and are sorted and displayed there...



But its taking about 2 minutes...thats too much.



What to do for reducing the parse time?



Or am i wrong using SAX parsing???Suggestions please....



SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();
XMLReader xr = sp.getXMLReader();

/** Send URL to parse XML Tags */
URL sourceUrl = new URL(url);

/** Create handler to handle XML Tags ( extends DefaultHandler ) */
XmlHandler xmlHandler4Profile = new XmlHandler();
xr.setContentHandler(xmlHandler4Profile);
xr.parse(new InputSource(sourceUrl.openStream()));

}




No comments:

Post a Comment