I am focusing on an Android application that utilizes a SQLLiteDatabase. I have taken steps that I close and open the database if needed. The applying opens it when produced as well as in onResume, also it shuts it in onPause and onDestroy. However get the mistake saying the database is not closed. I've even put System.out's in each one of the close techniques to make sure that they're being known as, all of them are, yet I get the mistake it is not closed.

So what can I actually do to ensure that the database is correctly "closed"?

Thanks, RiceX1055

Cursor cursor = null;
try {
    // initialize and do things with the cursor
} finally {
    if (!cursor.isClosed() || cursor != null) {
        cursor.close();
    }
}

make use of this. This works best for me.