People overuse the Application class because of a poor understanding
of what its lifecycle semantics are.  To top that, they're not
especially well explained in most documentation or books.

But if you're storing things in the application class, you probably
shouldn't be, why not store them in persistent storage instead?

Kris


On Sun, Feb 10, 2013 at 10:26 AM, dashman <[email protected]> wrote:
> Making sure i understand this
>
> When an activity is asleep, it could be destroyed by the os.
>
> if destroyed, onDestroyed() will be called.
>
> if not destroyed, it'll be resumed.
>
> The reason i asked the original question was this.
>
> I have an Activity as well as an Application sub-class - i store
> some values there.
>
> I put the app to sleep and when i wake up - the variables in the
> Activity are initialized to new whereas the values in the Application
> object are still there.
>
> So looks like on wakeup - a new instance of Activity was created
> but the old Application object was used.
>
> Make sense?
>
>
> --
> --
> 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
> ---
> You received this message because you are subscribed to the Google Groups
> "Android Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to