I have a function that should delete a record in my sqlite database. But it is not deleting, what could be wrong?
public boolean deleteLoc(String id) {
boolean deleteSuccessful = false;
try {
SQLiteDatabase db = this.getWritableDatabase();
deleteSuccessful = db.delete(TABLE_NAME, "id =" + id, null) > 0;
} catch (NullPointerException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
return deleteSuccessful;
}
it always returns false.
try out this:
otherwise there is no corresponding record in table…….have you checked your table for the entry you are trying to delete?