Home » Java » java – Sqlite not deleting rows on button click-Exceptionshub

java – Sqlite not deleting rows on button click-Exceptionshub

Posted by: admin February 25, 2020 Leave a comment

Questions:

So my Sqlite is working ok, but only when I delete rows slowly using button. When I delete few rows one by one fast and after that close my app only last deleted row disappears from database, and the rest stays. If I do the same thing but I’ll wait few seconds after deleting rows everything works fine. How can I speed it up, so it can work normally?

Method that deletes row:

    public void deleteData(String id) {
        SQLiteDatabase db = this.getWritableDatabase();
        db.delete(TABLE_NAME, "ID="+id, null);
    }

On button click:

myDb.deleteData(id);

Edit:
I’ve forgot to mention that my database is really small. Almost always there’s less than 10 records.

How to&Answers: