Getting Started in Android Development
Part 11 -
This tutorial focused on how to exit an Activity gracefully. After adding some extra buttons to the layout, the switch and case statement was expanded with a case statement for the quit button. The only command executed for the quit button case is the finish() method. The finish() methods calls the onDestroy() method and removes the activity from the activity stack.
At the end of this tutorial your MainActivity.java file should look similar to the one below.
At the end of this tutorial your activity_main.xml file should look similar to the one below.
Download Download tutorial set 1