[android-developers] Keeping a database instance open... Bad practice?

2009-08-19 Thread Armond Avanes

Hi Guys,

Is it a bad practice to keep an instance of open database (well actually an
instance of SQLiteOpenHelper and SQLiteDatabase) during application running?

Because every once in a while and with every activity screen some database
operations are done as well (both read/write), I open the database at
startup of my application (Application.onCreate()) and close it on shutdown
(Application.onTerminate()).

Please let me know if this may cause problem or should be done in another
way.

Best Regards,
Armond


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Keeping writable database instance open... Bad practice?

2009-08-11 Thread Armond Avanes

Hi Guys,

Is keeping a writable instance of a database open
(SQLiteOpenHelper.getWritableDatabase()) during the running application a
bad practice?
Because every once in a while and with every activity screen some database
operations are done as well (both read/write), I open the database at
startup of my application (Application.onCreate()) and close it on shutdown
(Application.onTerminate()).

Just in case it matters, I have background service as well (getting started
on BOOT_COMPLETED) which uses the same database via a separate call to
SQLiteOpenHelper.getWritableDatabase(). Of course here I open the database
whenever service onStart() is called and close it at end of the call.

Best Regards,
Armond


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---