11.07.2011 22:36, nadam пишет:
The docs says this:
> http://developer.android.com/guide/topics/fundamentals/activities.htm...
Yes. But it doesn't say exactly when this would happen and it doesn't
say whether a single Activity could be destroyed or only as part of
the whole app being destroyed (or when this would happen).
I believe this can happen when there is a deep stack of activities. As
posted before, there is a tool to make Android finish activities within
the stack, so you can test and debug this case during development.
> Not sure what you mean by "developer thinks"
I mean when the developer gets an error report and a stack trace in
the developer console that indicates that ActivityB is started but
ActivityA is not. The typical (error) situation for this is when
ActivityA initializes some static data that is accessed by ActivityB.
This can happen under a different scenario: the process gets killed,
then the user comes back to the application, with activity B at the top
of the stack.
Android will recreate B from saved state, to show it to the user, but
just because B was started by A, doesn't mean that it's going to
recreate A at this exact time. The result is that you'll have B and no A.
And if your code can't handle this, then it's a design bug: use lazy
initialization so your globals can be used by any component,
independently of any previous activity history.
--
Kostya Vasilyev
--
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