Yes if you call finish() you are saying you want to completely remove the
activity from the stack.  The system can have the activity destroyed in the
same way, but just not remove it from the stack it maintains.

At the end of the day, it would be fundamentally broken if there was a way
for an activity to stop being used in a process without being destroyed.
 This means it would be IMPOSSIBLE to write a correctly working application.
 I agree you can find parts of the documentation to help you convince
yourself that there are cases this can happen, if that is what you are
looking for.  But it won't.  Because it would be broken.  As I think is
already obvious to you, since your original question was basically: "if I
read the documentation this way then there is nothing useful at all about
onDestroy() or onStop() because they won't get called when they need to be."
 Right.  So don't try to read the documentation in a way that makes it
broken.

You are welcome to contribute changed to the documentation for people to
review if there are things you think can be improved.

On Thu, Apr 28, 2011 at 12:29 AM, Eric <e...@alum.mit.edu> wrote:

>
>
> On Apr 28, 12:21 am, Dianne Hackborn <hack...@android.com> wrote:
> > "Asking it to finish" means finishing the activity, which means
> destroying
> > it.  Politely asking it to finish isn't going to cause it to just not
> > cleanly exit.  It would be fundamentally broken if activities every just
> > stop being used in their process without actually going through the
> > lifecycle.
> >
> > In other words "asking to finish" -> Activity.finish() -> does what you
> > expect.
>
> Ok, so when I 'finish' an Activity programmatically, never wanting it
> to show up in the Task stack again, how does the system know to remove
> my Activity from the back stack in that case, but it doesn't remove it
> from the stack when the system asks it to finish due to low memory
> conditions?
>
> Also, the documentation for onDestroy() adds to the confusion a bit:
>
> "Called before the activity is destroyed. This is the final call that
> the activity will receive. It could be called either because the
> activity is finishing (someone called finish() on it), or because the
> system is temporarily destroying this instance of the activity to save
> space. You can distinguish between these two scenarios with the
> isFinishing() method."
>
> Note that it says if the Activity is being temporarily discarded to
> save space, then the 'isFinishing' method will return false.  If
> Android is simply calling 'finish' to temporarily discard the
> Activity, as you state, then is it explicitly setting 'isFinishing()'
> flag back to false (assuming the call to finish() automatically sets
> it to true; because if it didn't, then when I programmatically call
> 'finish()' to permanently finish the Activity, the flag would probably
> never get set)?
>
> - Eric
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to