Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build an Interactive Story App (Retired) Intents and Multiple Activities Introducing String Resources

Matthew Francis
Matthew Francis
6,967 Points

Using finish() (Intent Method) to end an activity

In this video there are 2 activities, let's call them in alphabetical order.

A -> B,

A starts the second Activity(B), B calls finish(). When finish() is called, it would go back to the previous activity again (A) and start Activity A. But what happens if there are multiple activites?

eg;

A -> B -> C -> D

if C calls finish(), does that destroy D? and where do you start again? A?

Does that mean w

1 Answer

Adam Sawicki
Adam Sawicki
15,967 Points

Now I can't imagine situation when C can call finish() when D activity exists and I don't even know if It is possible but technically finish() finishes only current opened activity to finish D activity from C you can use: finishActivity()