Ok, thanks all.

I prefer the singleton approach because it at least minimises memory
leaks (by keeping the number of connections to max 1 within the VM).

I wonder if its worth using a VM shutdown hook as a last line of
defense...

On Mar 23, 6:25 pm, Mark Murphy <[email protected]> wrote:
> westmeadboy wrote:
> > 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
>
> It will not be called if the process is terminated. It will be called
> late if you're running the Nexus One.
>
> > 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...?
>
> I would think you get incrementally better data integrity by properly
> closing the database.
>
> The process is not necessarily killed as part of a normal shutdown. The
> process may be recycled. I am uncertain if the VM itself is also
> recycled. If it is, you may introduce a memory leak as well.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Android App Developer Training:http://commonsware.com/training

-- 
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.

Reply via email to