mercredi 27 mai 2015

Usage of SQLiteOpenHelper getReadableDatabase/getWritableDatabase

When using SQLiteOpenHelper, why should I get a new reference to the database (via getReadableDatabase()/getWritableDatabase()) and not just keep a reference obtained by getWritableDatabase()?

What are the benefits? Isn't there an overhead in closing and opening the database every time?

In addition, should I proactively call getWritableDatabase() once to make sure the database is created before first use?

Aucun commentaire:

Enregistrer un commentaire