I am trying to update the value of a boolean field in an sqlite database column, i first want to check if the value of the field is 0 then if yes it should update the value to 1.
This is what i have so far:
String where = "student_number=?";
String[] whereArgs = new String[]{compare};
ContentValues cv = new ContentValues();
cv.put("student_number", 1);
if ("student_number" == "0") {
db.update("course1", cv, where, whereArgs);
Toast.makeText(getApplicationContext(), "Attendance Taken", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getApplicationContext(), "Attendance already registered.", Toast.LENGTH_LONG).show();
}
But it's not updating, i think the problem is with the if condition.
Aucun commentaire:
Enregistrer un commentaire