Intro to Android

Backstack

You can navigate forwards and backwards in an application.

The backstack keeps track of all new activities and fragments that were either implicitly or explictly added.

When you use startActivity() with an intent, it is automatically added to the backstack for you. With fragments, you can explicitly add the fragment to the backstack when committing a FragmentTransaction.

Back button

You can intercept back clicks in an Activity, though be careful because you shouldn't violate a user's expectations.

@Override
public void onBackPressed()
{
    ...
}