The singleton I already use has informOnCreate(Context) and informOnDestroy(Context) methods which are called from each activity so that is easy to implement.
Just a couple of questions: 1. I thought I remember reading that Activity.onDestroy() is often never called 2. How much of a big deal is it if that single database connection is not closed? I mean, won't the process get killed anyway...? On Mar 23, 6:01 pm, Mark Murphy <[email protected]> wrote: > westmeadboy wrote: > > Do you mean a new connection to the database for each activity? > > > With my model, the database connection is lazily opened but only once. > > Essentially, the database is opened the first time an activity is > > created in that VM. > > > I don't want to tie the lifecycle of the database connection to > > activities, but rather to the application/VM itself. > > That will be difficult. > > Create a reference-counting accessor to the database; when the reference > count hits zero, close it. If the reference count starts at zero on an > access request, open it. > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://twitter.com/commonsguy > > _The Busy Coder's Guide to *Advanced* Android Development_ > Version 1.3 Available! -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.

