I want to check if a Database variable has the value 5 and then change an image. The Log.d I do before I check with my if statment gives me the value 5 and the headline I want to check for, so the Data is in the Database. But my if-statement is not executed, "Done" is not logged and the image is not changed. Maybe I am using a wrong way to parse the cursor.getString(0) to Integer? There is no error logged.
DbHelper dbh = new DbHelper(context);
Cursor cursor = dbh.getScore(dbh);
cursor.moveToFirst();
if (cursor.moveToFirst()) {
do {
Log.d("Database", cursor.getString(0) + cursor.getString(1));
if (Integer.parseInt(cursor.getString(0))== 5 && Headline.toString().equals(cursor.getString(1))){
Log.d("Database","Done");
ImageDone.setImageResource(R.drawable.markerdone);
}
}
while(cursor.moveToNext());
}
cursor.close();
Aucun commentaire:
Enregistrer un commentaire