Thanks Dianne for your answers.

My problem regarding the database is that I need it during the
lifetime of the application. Now when you say that
Application.onTerminate() is not normally called, I have no place to
close it, other then open_and_close every time I need it.

Would that be a standard way of doing things? How costly is
open_and_close?

Thanks.

On Sep 30, 7:06 pm, Dianne Hackborn <[email protected]> wrote:
> onTerminate is -not- called under normal operation -- the process is just
> killed.  You are getting that message because you no longer have any
> references on the database but nobody has closed it, and now the garbage
> collector is eventually get around to it.  You should close the database
> when you are done with it.
>
> And yes, when returning to your app, the process is restarted, and only the
> visible activity is created at that point.
>
>
>
> On Wed, Sep 30, 2009 at 3:58 PM, gnugu <[email protected]> wrote:
>
> > Oh, also, when my process is killed while being in the background does
> > coming back from gallery restart the process jumping directly to
> > activity B? It's not in the documentation, that's why I need to ask
> > here.
>
> > Thanks.
>
> > On Sep 30, 3:52 pm, Dianne Hackborn <[email protected]> wrote:
> > > Yes your process can be killed at any time when it is in the background
> > (and
> > > onTerminate is NOT called).
>
> > > On Wed, Sep 30, 2009 at 3:47 PM, gnugu <[email protected]> wrote:
>
> > > > Hi,
> > > > When I start my application I prompt the user for the password and use
> > > > it to instantiate my data adapter object that I will need throughout
> > > > the application. So I store it in Application object.
>
> > > > My activity A prompts user for pwd, instantiates data adapter, sticks
> > > > it to Application object and later starts activity B which in turn
> > > > starts the built int gallery activity. When fooling around with
> > > > gallery and capturing pictures for some time coming back to activity B
> > > > I discover that Application.myDataAdapter is null.
>
> > > > I found out that during me playing with camera the
> > > > Application.onTerminate() method was called.
>
> > > > So it seems like Android killed my process and when B was supposed to
> > > > become visible it started a process again jumping directly to activity
> > > > B bypassing A?
>
> > > > Is that how it works? Should I then never assume that
> > > > Application.myField will survive? and init it not only when A is
> > > > started but whenever I discover it is null?
>
> > > > Thanks.
>
> > > --
> > > Dianne Hackborn
> > > Android framework engineer
> > > [email protected]
>
> > > Note: please don't send private questions to me, as I don't have time to
> > > provide private support, and so won't reply to such e-mails.  All such
> > > questions should be posted on public forums, where I and others can see
> > and
> > > answer them.
>
> --
> Dianne Hackborn
> Android framework engineer
> [email protected]
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to