On Thu, Jul 12, 2012 at 1:06 PM, user123 <[email protected]> wrote:

> And Activity B is always started just by Activity A


That is an incorrect assumption.

Picture this sequence of events: Activity A starts Activity B, then you
close out the app by pressing Home, then you come back to your app after
some time. In this case, the system will have killed your app (and wiped
your statics) and will start where it last left off, which is Activity B,
bypassing your static initialization and resulting in your null pointers.

You need some sort of lazy initialization or Singleton pattern to ensure
you always load the data you need if it's not already been loaded.

-------------------------------------------------------------------------------------------------
TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
transit tracking app for Android-powered devices

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