From performance point of view, regardless of other constraints:
What is the cost of opening a SQLiteDatabase in the whole application lifecycle?
Is it worth the effort to open/close everytime needed (and maintaining state)?
If you use SQLiteOpenHelper, it will cache your database object meaning it will be opened only once and closed only once. You can then use getReadableDatabase() or getWriteableDatabase() wherever and whenever is convenient because you will be using the cached database.
SQLiteOpenHelper also makes it really easy to create, open, and upgrade (and with API 11, downgrade too) your database and is the Google recommended way of working with SQLite.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With