Skip to content Skip to sidebar Skip to footer

Opening An Sqlite Database In A Background Thread

I am trying to better understand what it means to open an Sqlite database on a background thread in Android. Right now I am using a static/singleton pattern for my database via my

Solution 1:

You're correct that the code you wrote would open the database on a background thread. However, you wouldn't actually the database was opened until thread.isAlive() returned false (or mDatabase.isOpen() returned true). Alternatively, you could make your Activity listen for a callback from your Thread.


Post a Comment for "Opening An Sqlite Database In A Background Thread"