I am working a code which simply parses an XML; however, in a simple if-else if structure the app only does the inmediate statement after I open the {
private void processParsingUsuario(XmlPullParser parser) throws IOException, XmlPullParserException{ int eventType = parser.getEventType();
while (eventType != XmlPullParser.END_DOCUMENT) {
String eltName = null;
if(eventType == XmlPullParser.START_DOCUMENT) {
Log.i("Info","inicia el xml");
} else if(eventType == XmlPullParser.START_TAG) {
eltName = parser.getName();
Log.i("Info","inicia el tag " + eltName);
if("usu_id".equals(eltName)) {
Log.i("Info","usu id = " + parser.nextText());
usuario.usu_id = parser.nextText();
} else if("usu_nombre".equals(eltName)) {
Log.i("Info","usu nombre = " + parser.nextText());
} else if("usu_nombrecorto".equals(eltName)) {
welcomeText.setText("Hola " + parser.nextText());
Log.i("Info","usu nombre = " + parser.nextText());
}
}
eventType = parser.next();
}
}
In the case of the last 'else if' it should be doing both the setText and the Log, however, it is just doing the setText. If I switch them (if I place the log first, and then the setText, it just does the Log.
Aucun commentaire:
Enregistrer un commentaire