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.

On Mar 23, 5:24 pm, Streets Of Boston <[email protected]> wrote:
> What if you just close the connection to the database in the
> onDestroy?
> If the total number of connnections reaches 0, doesn't the database
> eventually shut-down?
>
> On Mar 23, 7:39 am, westmeadboy <[email protected]> wrote:
>
>
>
> > On Mar 11, 8:38 am, westmeadboy <[email protected]> wrote:
>
> > > In Activity1.onDestroy() I close the database. However, is this a good
> > > approach? Is it not possible that Activity1 is killed but Activity2
> > > stays alive? If so, then Activity2's db calls will suddenly fail.
>
> > Would be great if someone knows the answer to this?
>
> > I would rather close the database when the application (i.e. task?) is
> > terminated, but I don't know the proper place to make such a call.

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