SQLiteDatabase close() function causing NullPointerException when multiple threads

I have your answers!

Never close the db. It is that simple.

Make sure you only have one, repeat, *one Helper instance per application. Share it with all threads.

http://www.touchlab.co/blog/single-sqlite-connection/

Here’s some more info on the internals of sqlite and locking:

http://www.touchlab.co/blog/android-sqlite-locking/

Leave a Comment