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 The Rest of the Story Navigation with Back and Up

Mustafa Ogün Öztürk
Mustafa Ogün Öztürk
3,468 Points

Up vs Back

Why cant we see the name written on EditText when we click UP button while we are able to see it when we click back button ?

What is the difference ?

Thanks

1 Answer

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

By default, the Up navigation creates a new instance of the activity it leads to. This means that it hits the onCreate method again, and our EditText is reset to default starting value. The Back button goes back to the same instance of the activity and hits the onResume method (if it's still in memory, which is not guaranteed). A more detailed answer: https://stackoverflow.com/a/20975209/4875527