Skip to content Skip to sidebar Skip to footer

Room - Database Gets Locked After A Delete Query

I'm trying to delete a row from my database. When I first delete it for the first time, the row gets removed successfully. After I try to remove another row, I get an error that th

Solution 1:

I've solved the issue this way.

Instead of using the singleton class to insert or delete, I'm simply calling this code directly:

 WordLayListAppDatabase db = Room.databaseBuilder(getApplicationContext(),
                        WordLayListAppDatabase.class, "wordLayList").build();
                db.wordLayListDao().DeleteWordLayListByObject(o);

Now, I'm using the singleton class to only fetch the data. To update the database, I'm using the code above (The above is always called in Async Task).


Post a Comment for "Room - Database Gets Locked After A Delete Query"