class cast exception on using xmlresouceparser with Document
Hi all i have a class cast exception, No idea what is this, Can any one help on this
XmlResourceParser fXmlFile = mn.getResources().getXml(R.layout.savecredentials);
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
Document doc = docBuilder.parse((InputStream) fX开发者_如何学JAVAmlFile); //exception is on //this line
You're casting an XmlResourceParser
XmlResourceParser fXmlFile = mn.getResources().getXml(R.layout.savecredentials);
to an InputStream:
docBuilder.parse((InputStream) fXmlFile);
精彩评论