I currently use the following pattern when accessing my SQLite database (possibly from different threads):
try(SQLiteDatabase db = new MySqliteOpenHelper(context).getWritableDatabase()) {
...
}
Until now I thought that it was clean and thread-safe, but I got some crashes due to "Database is locked".
Why is this pattern wrong and how should I change it?