When you create an app’s project in the IDE, the MainActivity
is configured to display an options menu () at the right side of the action bar. The menu contains a Settings menu item that’s typically used to display an app’s settings to the user. In later apps, you’ll learn how to create additional menu items and how to decide which items should be displayed directly on the action bar vs. in the options menu.
The options menu is an object of class Menu (package android.view
). To specify Menu
options, you override Activity
’s onCreateOptionsMenu method (Section 5.5.4) to add the options to the method’s Menu
argument. When the user selects a menu item, Activity
method onOptionsItemSelected (Section 5.5.5) responds to the selection.