Android apps can contain, multiple activity, and an activity can start another activity. These activity is managed using the stack structure, and the newly opened activity is stacked on top of the current activity, and the current activity stops running. When an activity stops running, the Android system retains its state before it stops, and when the user presses the "Back" button, the top activity from the stack is pushed off the stack, and the previous activity moves to the top of the stack, which is displayed on the screen:
Sometimes, when an activity starts a new activity, it does not want to keep the current activity on the activity stack, for example, when a confirm dialog is implemented using an activity, when the user confirms and starts a new activity, Do not want to display confirm Dialog when the new activity is displayed by pressing "back".
Example fowarding uses finish () to end the current activity while starting a new activity.
Intent Intent = new Intent ();
Intent.setclass (Forwarding.this, forwardtarget.class);
StartActivity (intent);
Finish ();
Finish finishes forwarding activity, then press "Back", then go straight to the Apidemo->activity sample list, not forwarding.