Android Guides | Samples

Android.App.Activity.OnCreateOptionsMenu Method

Initialize the contents of the Activity's standard options menu.


[Android.Runtime.Register("onCreateOptionsMenu", "(Landroid/view/Menu;)Z", "GetOnCreateOptionsMenu_Landroid_view_Menu_Handler")]
public virtual Boolean OnCreateOptionsMenu (IMenu menu)

See Also


The options menu in which you place your items.


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 Activity.OnPrepareOptionsMenu(IMenu).

The default implementation populates the menu with standard system menu items. These are placed in the Android.Views.Menu.CATEGORY_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 Activity.OnOptionsItemSelected(IMenuItem) method to handle them there.

[Android Documentation]


Namespace: Android.App
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions:
Since: Added in API level 1