1

Should SQLiteDatabase be a member of my database helper?

view story
linux-howto

http://stackoverflow.com – I have the database helper DBHelper shown below. Now, I'm not sure where I should instanciate my SQLiteDatabase object to insert/update/delete a DB entry. I'm thinking of two possibilities: 1- instanciate and close it in every request (as shown in the addUser1 method in DBHelper), but this seems like a lot of work when there are many requests. 2- add a SQLiteDatabase member to DBHelper: private SQLiteDatabase mDatabase; public void open() throws SQLException { mDatabase = dbOpenHelper.getWritableDatabase(); } public void close() { if (mDatabase != null) (HowTos)