Vote count:
0
I am parsing my database and my application goes NPE. Now, i checked what happened in the database thru another app. This is my xmlparser method.
try {
float scorefloat = 0;
while (parser.next() != XmlPullParser.END_TAG) {
if (parser.getEventType() != XmlPullParser.START_TAG) {
continue;
}
String name = parser.getName();
if (name.equals("record")) {
String id = null, workoutName = null, muscletype = null, machine = null,
score=null, videopath=null;
Workout w = new Workout(workoutName, muscletype, machine, scorefloat, videopath);
while (parser.next() != XmlPullParser.END_TAG) {
if (parser.getEventType() != XmlPullParser.START_TAG) {
continue;
}
name = parser.getName();
if (name.equals("id")) {
id = readText(parser);
} else if (name.equals("workoutname")) {
workoutName = readText(parser);
w.setWorkoutName(workoutName);
} else if (name.equals("muscletype")) {
muscletype = readText(parser);
w.setMuscleType(muscletype);
} else if (name.equals("machine")) {
machine = readText(parser);
w.setMachine(machine);
} else if (name.equals("score")){
score = readText(parser);
w.setScore(Float.parseFloat(score));
} else if (name.equals("videopath")){
videopath = readText(parser);
w.setVideoPath(videopath);
}
myDbHelper.insertWorkout(w);
}
}
this is the output of the database: http://ift.tt/1u5jdi5
asked 19 secs ago
Why my XMLParser do this to my database?
Aucun commentaire:
Enregistrer un commentaire