I have a class with:
public String chceXML() {
try {
Document doc = loadTestDocument("http://meteo.pl/xml_um_date.php");
doc.getDocumentElement().normalize();
NodeList nList = doc.getElementsByTagName("data");
for (int temp = 0; temp < nList.getLength(); temp++) {
Node nNode = nList.item(temp);
if (nNode.getNodeType() == Node.ELEMENT_NODE) {
Element eElement = (Element) nNode;
return eElement
.getElementsByTagName("act_model_date")
.item(0)
.getTextContent()
.replace(" ","")
.toString();
}
}
}
catch (Exception e) {
e.printStackTrace();
return "wrong";
}
return null;
}
And I show it by:
XMLParser dM = new XMLParser();
Toast.makeText(getApplicationContext(), "XML: "+dM.chceXML(),Toast.LENGTH_LONG).show();
And unfortunately it is "wrong".
By the way, it working in NETBeans! But not working in Android Studio.
Please help me!