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.

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