Your first comment was correct -- finishActivity lets B finish C if B was
the one that used startActivityForResult() to start C.  The requestCode has
no meaning outside the context of B.

On Thu, Nov 5, 2009 at 3:04 PM, PJ <[email protected]> wrote:

> Hmm, I went back and read the Javadoc for finishActivity(), and it's
> not clear whether activities should be allowed to use finishActivity()
> for activities that it didn't start.  I can interpret it both ways.
> So, you may be right; maybe it should work.
>
> But at the very least, maybe you could try the different approach
> above.  /shrug
>
> I hope you let us know how it turns out, because I've only used finish
> (), and not finishActivity().
>
>
>
> On Nov 5, 4:54 pm, PJ <[email protected]> wrote:
> > Check out this discussion, it sounds similar to what you want to
> > accomplish:
> http://groups.google.com/group/android-developers/browse_thread/threa...
> >
> > Specifically, check out FLAG_ACTIVITY_CLEAR_TOP at:
> http://developer.android.com/reference/android/content/Intent.html#FL...
> >
> > Hope this helps!
> > -- PJ
> >
> > On Nov 5, 4:48 pm, PJ <[email protected]> wrote:
> >
> >
> >
> > > finishActivity() is intended to be used to force-finish an activity,
> > > *** from the same activity that started it ***.
> > > So, if you want to force-finish Activity B, then I think Main Activity
> > > is the only one that can do it via finishActivity(), because Main
> > > Activity is the one that started it.
> >
> > > However, I think there's a way for Activity C to terminate and to go
> > > back directly to Main Activity and to ask Main Activity to destroy all
> > > activities "above" it (B).  Let me see if I can find that...
> >
> > > -- PJ
> >
> > > On Nov 5, 2:58 pm, Bob Cai <[email protected]> wrote:
> >
> > > > Hello,
> >
> > > > In main Activity, I called startActivityForResult(intentB, 100) to
> start a
> > > > new activity B, then in B, I called startActivity(intentC) to start
> another
> > > > activity C. Lastly I wanted to call finishActivity(100) in C to close
> > > > activity B, but seemed it was not successfully destoried(I can use
> BACK key
> > > > to see it's still there.).
> >
> > > > Anyone can give advice of this?
> >
> > > > Thanks,
> > > > Bob- Hide quoted text -
> >
> > > - Show quoted text -- Hide quoted text -
> >
> > - Show quoted text -
>
> --
> 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]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Dianne Hackborn
Android framework engineer
[email protected]

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