Ok, thanks, this was exactly what I needed to know. The case where the system kills the app while being in the background and not in first screen.
Am Montag, 25. Februar 2013 18:21:27 UTC+1 schrieb Streets Of Boston: > > In addition to Treking's answer; > > Never rely on the order in which (you think that) activities are started > to initialize or modify static/global data. > > E.g. > User goes through your app, starting from the homescreen, going from > Activity A then to Activity B then to C. This could be order in which the > activities are created: > > A --> B --> C > > Now your user presses the Home key and does something else for a while and > the OS decides to kill your app, because it is in the background. > > When the user comes back to your app, this may happen (it depends how your > activities were launched): > First Activity C is shown, since that was the last one that the user saw. > When the user now hits the back-button a few times, this could be the order > in which the activities are created: > > C --> B --> A. > > Total different order. If your global/static data relies on the > activitie's creation order, you may run into subtle or not-so-subtle > problems. > > > On Monday, February 25, 2013 11:34:43 AM UTC-5, TreKing wrote: >> >> >> On Mon, Feb 25, 2013 at 3:52 AM, user123 <[email protected]> wrote: >> >>> And I'm wondering, if there's any case where I can get a null pointer? >>> Because e.g. the system kills the app while it's in the background, and >>> tries to restart it in the last screen - since the variable is only >>> initialized in the launcher screen, it will not be initialized? Does this >>> case exist? >>> >> >> To answer your question, yes that exact case does exist, so you don't >> want to initialize your data in the launcher screen. >> >> >> ------------------------------------------------------------------------------------------------- >> 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 --- 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.

