onCreateOptionsMenu - Create an Options Menu

public boolean onCreateOptionsMenu (Menu menu) was added in API level 1
Initialize the contents of the Activity's standard options menu. You should place your menu items in to menu.
This is only called once, the first time the options menu is displayed. To update the menu every time it is displayed, see onPrepareOptionsMenu(Menu).
The default implementation populates the menu with standard system menu items. These are placed in theCATEGORY_SYSTEM group so that they will be correctly ordered with application-defined menu items. Deriving classes should always call through to the base implementation.
You can safely hold on to menu (and any items created from it), making modifications to it as desired, until the next time onCreateOptionsMenu() is called.
When you add items to the menu, you can implement the Activity's onOptionsItemSelected(MenuItem) method to handle them there.
Parameters: menu - The options menu in which you place your items.
Returns: You must return true for the menu to be displayed; if you return false it will not be shown.

1. In the MainActivity.java file, add the below line to the imports section.

import android.view.Menu;

2. Add the below method to your class, after the other methods.

@Override
public boolean onCreateOptionsMenu(Menu menu) {
  return true;
}

3. Inflate a Menu named mymenu in the onCreateOptionsMenu method before the return true line of code. This will inflate the file in res/menu named mymenu.

4. Compile and run!
Next Recommended Article: onMenuItemSelected - Create Action when Menu Item is Pressed Resources: http://developer.android.com/reference/android/app/Activity.html#onCreateOptionsMenu(android.view.Menu)