다음을 통해 공유


Activity.OnContextItemSelected(IMenuItem) Method

Definition

This hook is called whenever an item in a context menu is selected.

[Android.Runtime.Register("onContextItemSelected", "(Landroid/view/MenuItem;)Z", "GetOnContextItemSelected_Landroid_view_MenuItem_Handler")]
public virtual bool OnContextItemSelected (Android.Views.IMenuItem item);
[<Android.Runtime.Register("onContextItemSelected", "(Landroid/view/MenuItem;)Z", "GetOnContextItemSelected_Landroid_view_MenuItem_Handler")>]
abstract member OnContextItemSelected : Android.Views.IMenuItem -> bool
override this.OnContextItemSelected : Android.Views.IMenuItem -> bool

Parameters

item
IMenuItem

The context menu item that was selected.

Returns

boolean Return false to allow normal context menu processing to proceed, true to consume it here.

Attributes

Remarks

This hook is called whenever an item in a context menu is selected. The default implementation simply returns false to have the normal processing happen (calling the item's Runnable or sending a message to its Handler as appropriate). You can use this method for any items for which you would like to do processing without those other facilities.

Use MenuItem#getMenuInfo() to get extra information set by the View that added this menu item.

Derived classes should call through to the base class for it to perform the default menu handling.

Java documentation for android.app.Activity.onContextItemSelected(android.view.MenuItem).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to