Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

# MenuItem

*** ** * ** ***

` public interface MenuItem `   
` `

|---|
| android.view.MenuItem |

<br />

*** ** * ** ***

Interface for direct access to a previously created menu item.

An Item is returned by calling one of the `https://developer.android.com/reference/android/view/Menu#add(int)` methods.

For a feature set of specific menu types, see `https://developer.android.com/reference/android/view/Menu`.

### Developer Guides

For information about creating menus, read the [Menus](https://developer.android.com/guide/topics/ui/menus) developer guide.

<br />

## Summary

| ### Nested classes ||
|---|---|
| ` interface` | `https://developer.android.com/reference/android/view/MenuItem.OnActionExpandListener` Interface definition for a callback to be invoked when a menu item marked with `https://developer.android.com/reference/android/view/MenuItem#SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW` is expanded or collapsed. |
| ` interface` | `https://developer.android.com/reference/android/view/MenuItem.OnMenuItemClickListener` Interface definition for a callback to be invoked when a menu item is clicked. |

| ### XML attributes ||
|---|---|
| [`android:iconTint`](https://developer.android.com/reference/android/view/MenuItem#attr_android:iconTint) | Tint to apply to the icon. |
| [`android:iconTintMode`](https://developer.android.com/reference/android/view/MenuItem#attr_android:iconTintMode) | Blending mode used to apply the icon tint. |

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/view/MenuItem#SHOW_AS_ACTION_ALWAYS` Always show this item as a button in an Action Bar. |
| `int` | `https://developer.android.com/reference/android/view/MenuItem#SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW` This item's action view collapses to a normal menu item. |
| `int` | `https://developer.android.com/reference/android/view/MenuItem#SHOW_AS_ACTION_IF_ROOM` Show this item as a button in an Action Bar if the system decides there is room for it. |
| `int` | `https://developer.android.com/reference/android/view/MenuItem#SHOW_AS_ACTION_NEVER` Never show this item as a button in an Action Bar. |
| `int` | `https://developer.android.com/reference/android/view/MenuItem#SHOW_AS_ACTION_WITH_TEXT` When this item is in the action bar, always show it with a text label even if it also has an icon specified. |

| ### Public methods ||
|---|---|
| ` abstract boolean` | ` https://developer.android.com/reference/android/view/MenuItem#collapseActionView()() ` Collapse the action view associated with this menu item. |
| ` abstract boolean` | ` https://developer.android.com/reference/android/view/MenuItem#expandActionView()() ` Expand the action view associated with this menu item. |
| ` abstract https://developer.android.com/reference/android/view/ActionProvider` | ` https://developer.android.com/reference/android/view/MenuItem#getActionProvider()() ` Gets the `https://developer.android.com/reference/android/view/ActionProvider`. |
| ` abstract https://developer.android.com/reference/android/view/View` | ` https://developer.android.com/reference/android/view/MenuItem#getActionView()() ` Returns the currently set action view for this menu item. |
| ` default int` | ` https://developer.android.com/reference/android/view/MenuItem#getAlphabeticModifiers()() ` Return the modifier for this menu item's alphabetic shortcut. |
| ` abstract char` | ` https://developer.android.com/reference/android/view/MenuItem#getAlphabeticShortcut()() ` Return the char for this menu item's alphabetic shortcut. |
| ` default https://developer.android.com/reference/java/lang/CharSequence` | ` https://developer.android.com/reference/android/view/MenuItem#getContentDescription()() ` Retrieve the content description associated with this menu item. |
| ` abstract int` | ` https://developer.android.com/reference/android/view/MenuItem#getGroupId()() ` Return the group identifier that this menu item is part of. |
| ` abstract https://developer.android.com/reference/android/graphics/drawable/Drawable` | ` https://developer.android.com/reference/android/view/MenuItem#getIcon()() ` Returns the icon for this item as a Drawable (getting it from resources if it hasn't been loaded before). |
| ` default https://developer.android.com/reference/android/graphics/BlendMode` | ` https://developer.android.com/reference/android/view/MenuItem#getIconTintBlendMode()() ` Returns the blending mode used to apply the tint to this item's icon, if specified. |
| ` default https://developer.android.com/reference/android/content/res/ColorStateList` | ` https://developer.android.com/reference/android/view/MenuItem#getIconTintList()() ` |
| ` default https://developer.android.com/reference/android/graphics/PorterDuff.Mode` | ` https://developer.android.com/reference/android/view/MenuItem#getIconTintMode()() ` Returns the blending mode used to apply the tint to this item's icon, if specified. |
| ` abstract https://developer.android.com/reference/android/content/Intent` | ` https://developer.android.com/reference/android/view/MenuItem#getIntent()() ` Return the Intent associated with this item. |
| ` abstract int` | ` https://developer.android.com/reference/android/view/MenuItem#getItemId()() ` Return the identifier for this menu item. |
| ` abstract https://developer.android.com/reference/android/view/ContextMenu.ContextMenuInfo` | ` https://developer.android.com/reference/android/view/MenuItem#getMenuInfo()() ` Gets the extra information linked to this menu item. |
| ` default int` | ` https://developer.android.com/reference/android/view/MenuItem#getNumericModifiers()() ` Return the modifiers for this menu item's numeric (12-key) shortcut. |
| ` abstract char` | ` https://developer.android.com/reference/android/view/MenuItem#getNumericShortcut()() ` Return the char for this menu item's numeric (12-key) shortcut. |
| ` abstract int` | ` https://developer.android.com/reference/android/view/MenuItem#getOrder()() ` Return the category and order within the category of this item. |
| ` abstract https://developer.android.com/reference/android/view/SubMenu` | ` https://developer.android.com/reference/android/view/MenuItem#getSubMenu()() ` Get the sub-menu to be invoked when this item is selected, if it has one. |
| ` abstract https://developer.android.com/reference/java/lang/CharSequence` | ` https://developer.android.com/reference/android/view/MenuItem#getTitle()() ` Retrieve the current title of the item. |
| ` abstract https://developer.android.com/reference/java/lang/CharSequence` | ` https://developer.android.com/reference/android/view/MenuItem#getTitleCondensed()() ` Retrieve the current condensed title of the item. |
| ` default https://developer.android.com/reference/java/lang/CharSequence` | ` https://developer.android.com/reference/android/view/MenuItem#getTooltipText()() ` Retrieve the tooltip text associated with this menu item. |
| ` abstract boolean` | ` https://developer.android.com/reference/android/view/MenuItem#hasSubMenu()() ` Check whether this item has an associated sub-menu. |
| ` abstract boolean` | ` https://developer.android.com/reference/android/view/MenuItem#isActionViewExpanded()() ` Returns true if this menu item's action view has been expanded. |
| ` abstract boolean` | ` https://developer.android.com/reference/android/view/MenuItem#isCheckable()() ` Return whether the item can currently display a check mark. |
| ` abstract boolean` | ` https://developer.android.com/reference/android/view/MenuItem#isChecked()() ` Return whether the item is currently displaying a check mark. |
| ` abstract boolean` | ` https://developer.android.com/reference/android/view/MenuItem#isEnabled()() ` Return the enabled state of the menu item. |
| ` abstract boolean` | ` https://developer.android.com/reference/android/view/MenuItem#isVisible()() ` Return the visibility of the menu item. |
| ` abstract https://developer.android.com/reference/android/view/MenuItem` | ` https://developer.android.com/reference/android/view/MenuItem#setActionProvider(android.view.ActionProvider)(https://developer.android.com/reference/android/view/ActionProvider actionProvider) ` Sets the `https://developer.android.com/reference/android/view/ActionProvider` responsible for creating an action view if the item is placed on the action bar. |
| ` abstract https://developer.android.com/reference/android/view/MenuItem` | ` https://developer.android.com/reference/android/view/MenuItem#setActionView(int)(int resId) ` Set an action view for this menu item. |
| ` abstract https://developer.android.com/reference/android/view/MenuItem` | ` https://developer.android.com/reference/android/view/MenuItem#setActionView(android.view.View)(https://developer.android.com/reference/android/view/View view) ` Set an action view for this menu item. |
| ` abstract https://developer.android.com/reference/android/view/MenuItem` | ` https://developer.android.com/reference/android/view/MenuItem#setAlphabeticShortcut(char)(char alphaChar) ` Change the alphabetic shortcut associated with this item. |
| ` default https://developer.android.com/reference/android/view/MenuItem` | ` https://developer.android.com/reference/android/view/MenuItem#setAlphabeticShortcut(char,%20int)(char alphaChar, int alphaModifiers) ` Change the alphabetic shortcut associated with this item. |
| ` abstract https://developer.android.com/reference/android/view/MenuItem` | ` https://developer.android.com/reference/android/view/MenuItem#setCheckable(boolean)(boolean checkable) ` Control whether this item can display a check mark. |
| ` abstract https://developer.android.com/reference/android/view/MenuItem` | ` https://developer.android.com/reference/android/view/MenuItem#setChecked(boolean)(boolean checked) ` Control whether this item is shown with a check mark. |
| ` default https://developer.android.com/reference/android/view/MenuItem` | ` https://developer.android.com/reference/android/view/MenuItem#setContentDescription(java.lang.CharSequence)(https://developer.android.com/reference/java/lang/CharSequence contentDescription) ` Change the content description associated with this menu item. |
| ` abstract https://developer.android.com/reference/android/view/MenuItem` | ` https://developer.android.com/reference/android/view/MenuItem#setEnabled(boolean)(boolean enabled) ` Sets whether the menu item is enabled. |
| ` abstract https://developer.android.com/reference/android/view/MenuItem` | ` https://developer.android.com/reference/android/view/MenuItem#setIcon(android.graphics.drawable.Drawable)(https://developer.android.com/reference/android/graphics/drawable/Drawable icon) ` Change the icon associated with this item. |
| ` abstract https://developer.android.com/reference/android/view/MenuItem` | ` https://developer.android.com/reference/android/view/MenuItem#setIcon(int)(int iconRes) ` Change the icon associated with this item. |
| ` default https://developer.android.com/reference/android/view/MenuItem` | ` https://developer.android.com/reference/android/view/MenuItem#setIconTintBlendMode(android.graphics.BlendMode)(https://developer.android.com/reference/android/graphics/BlendMode blendMode) ` Specifies the blending mode used to apply the tint specified by `https://developer.android.com/reference/android/view/MenuItem#setIconTintList(android.content.res.ColorStateList)` to this item's icon. |
| ` default https://developer.android.com/reference/android/view/MenuItem` | ` https://developer.android.com/reference/android/view/MenuItem#setIconTintList(android.content.res.ColorStateList)(https://developer.android.com/reference/android/content/res/ColorStateList tint) ` Applies a tint to this item's icon. |
| ` default https://developer.android.com/reference/android/view/MenuItem` | ` https://developer.android.com/reference/android/view/MenuItem#setIconTintMode(android.graphics.PorterDuff.Mode)(https://developer.android.com/reference/android/graphics/PorterDuff.Mode tintMode) ` Specifies the blending mode used to apply the tint specified by `https://developer.android.com/reference/android/view/MenuItem#setIconTintList(android.content.res.ColorStateList)` to this item's icon. |
| ` abstract https://developer.android.com/reference/android/view/MenuItem` | ` https://developer.android.com/reference/android/view/MenuItem#setIntent(android.content.Intent)(https://developer.android.com/reference/android/content/Intent intent) ` Change the Intent associated with this item. |
| ` default https://developer.android.com/reference/android/view/MenuItem` | ` https://developer.android.com/reference/android/view/MenuItem#setNumericShortcut(char,%20int)(char numericChar, int numericModifiers) ` Change the numeric shortcut and modifiers associated with this item. |
| ` abstract https://developer.android.com/reference/android/view/MenuItem` | ` https://developer.android.com/reference/android/view/MenuItem#setNumericShortcut(char)(char numericChar) ` Change the numeric shortcut associated with this item. |
| ` abstract https://developer.android.com/reference/android/view/MenuItem` | ` https://developer.android.com/reference/android/view/MenuItem#setOnActionExpandListener(android.view.MenuItem.OnActionExpandListener)(https://developer.android.com/reference/android/view/MenuItem.OnActionExpandListener listener) ` Set an `https://developer.android.com/reference/android/view/MenuItem.OnActionExpandListener` on this menu item to be notified when the associated action view is expanded or collapsed. |
| ` abstract https://developer.android.com/reference/android/view/MenuItem` | ` https://developer.android.com/reference/android/view/MenuItem#setOnMenuItemClickListener(android.view.MenuItem.OnMenuItemClickListener)(https://developer.android.com/reference/android/view/MenuItem.OnMenuItemClickListener menuItemClickListener) ` Set a custom listener for invocation of this menu item. |
| ` abstract https://developer.android.com/reference/android/view/MenuItem` | ` https://developer.android.com/reference/android/view/MenuItem#setShortcut(char,%20char)(char numericChar, char alphaChar) ` Change both the numeric and alphabetic shortcut associated with this item. |
| ` default https://developer.android.com/reference/android/view/MenuItem` | ` https://developer.android.com/reference/android/view/MenuItem#setShortcut(char,%20char,%20int,%20int)(char numericChar, char alphaChar, int numericModifiers, int alphaModifiers) ` Change both the numeric and alphabetic shortcut associated with this item. |
| ` abstract void` | ` https://developer.android.com/reference/android/view/MenuItem#setShowAsAction(int)(int actionEnum) ` Sets how this item should display in the presence of an Action Bar. |
| ` abstract https://developer.android.com/reference/android/view/MenuItem` | ` https://developer.android.com/reference/android/view/MenuItem#setShowAsActionFlags(int)(int actionEnum) ` Sets how this item should display in the presence of an Action Bar. |
| ` abstract https://developer.android.com/reference/android/view/MenuItem` | ` https://developer.android.com/reference/android/view/MenuItem#setTitle(java.lang.CharSequence)(https://developer.android.com/reference/java/lang/CharSequence title) ` Change the title associated with this item. |
| ` abstract https://developer.android.com/reference/android/view/MenuItem` | ` https://developer.android.com/reference/android/view/MenuItem#setTitle(int)(int title) ` Change the title associated with this item. |
| ` abstract https://developer.android.com/reference/android/view/MenuItem` | ` https://developer.android.com/reference/android/view/MenuItem#setTitleCondensed(java.lang.CharSequence)(https://developer.android.com/reference/java/lang/CharSequence title) ` Change the condensed title associated with this item. |
| ` default https://developer.android.com/reference/android/view/MenuItem` | ` https://developer.android.com/reference/android/view/MenuItem#setTooltipText(java.lang.CharSequence)(https://developer.android.com/reference/java/lang/CharSequence tooltipText) ` Change the tooltip text associated with this menu item. |
| ` abstract https://developer.android.com/reference/android/view/MenuItem` | ` https://developer.android.com/reference/android/view/MenuItem#setVisible(boolean)(boolean visible) ` Sets the visibility of the menu item. |

## XML attributes

### android:iconTint

Tint to apply to the icon.

May be a color value, in the form of "`#*rgb*`", "`#*argb*`", "`#*rrggbb*`", or "`#*aarrggbb*`".

<br />

**Related methods:**

- `https://developer.android.com/reference/android/view/MenuItem#setIconTintList(android.content.res.ColorStateList)`

### android:iconTintMode

Blending mode used to apply the icon tint.

Must be one of the following constant values.

| Constant | Value | Description |
|---|---|---|
| add | 10 | Combines the tint and icon color and alpha channels, clamping the result to valid color values. Saturate(S + D) |
| multiply | e | Multiplies the color and alpha channels of the icon with those of the tint. \[Sa \* Da, Sc \* Dc\] |
| screen | f | \[Sa + Da - Sa \* Da, Sc + Dc - Sc \* Dc\] |
| src_atop | 9 | The tint is drawn above the icon, but with the icon\\u2019s alpha channel masking the result. \[Da, Sc \* Da + (1 - Sa) \* Dc\] |
| src_in | 5 | The tint is masked by the alpha channel of the icon. The icon\\u2019s color channels are thrown out. \[Sa \* Da, Sc \* Da\] |
| src_over | 3 | The tint is drawn on top of the icon. \[Sa + (1 - Sa)\*Da, Rc = Sc + (1 - Sa)\*Dc\] |

<br />

<br />

**Related methods:**

- `https://developer.android.com/reference/android/view/MenuItem#setIconTintMode(android.graphics.PorterDuff.Mode)`

## Constants

### SHOW_AS_ACTION_ALWAYS

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SHOW_AS_ACTION_ALWAYS
```

Always show this item as a button in an Action Bar. Use sparingly! If too many items are set to always show in the Action Bar it can crowd the Action Bar and degrade the user experience on devices with smaller screens. A good rule of thumb is to have no more than 2 items set to always show at a time.

<br />

Constant Value: 2 (0x00000002)

### SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW
```

This item's action view collapses to a normal menu item. When expanded, the action view temporarily takes over a larger segment of its container.

<br />

Constant Value: 8 (0x00000008)

### SHOW_AS_ACTION_IF_ROOM

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SHOW_AS_ACTION_IF_ROOM
```

Show this item as a button in an Action Bar if the system decides there is room for it.

<br />

Constant Value: 1 (0x00000001)

### SHOW_AS_ACTION_NEVER

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SHOW_AS_ACTION_NEVER
```

Never show this item as a button in an Action Bar.

<br />

Constant Value: 0 (0x00000000)

### SHOW_AS_ACTION_WITH_TEXT

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SHOW_AS_ACTION_WITH_TEXT
```

When this item is in the action bar, always show it with a text label even if it also has an icon specified.

<br />

Constant Value: 4 (0x00000004)

## Public methods

### collapseActionView

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract boolean collapseActionView ()
```

Collapse the action view associated with this menu item. The menu item must have an action view set, as well as the showAsAction flag `https://developer.android.com/reference/android/view/MenuItem#SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW`. If a listener has been set using `https://developer.android.com/reference/android/view/MenuItem#setOnActionExpandListener(android.view.MenuItem.OnActionExpandListener)` it will have its `https://developer.android.com/reference/android/view/MenuItem.OnActionExpandListener#onMenuItemActionCollapse(android.view.MenuItem)` method invoked. The listener may return false from this method to prevent collapsing the action view.

<br />

| Returns ||
|---|---|
| `boolean` | true if the action view was collapsed, false otherwise. <br /> |

### expandActionView

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract boolean expandActionView ()
```

Expand the action view associated with this menu item. The menu item must have an action view set, as well as the showAsAction flag `https://developer.android.com/reference/android/view/MenuItem#SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW`. If a listener has been set using `https://developer.android.com/reference/android/view/MenuItem#setOnActionExpandListener(android.view.MenuItem.OnActionExpandListener)` it will have its `https://developer.android.com/reference/android/view/MenuItem.OnActionExpandListener#onMenuItemActionExpand(android.view.MenuItem)` method invoked. The listener may return false from this method to prevent expanding the action view.

<br />

| Returns ||
|---|---|
| `boolean` | true if the action view was expanded, false otherwise. <br /> |

### getActionProvider

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract ActionProvider getActionProvider ()
```

Gets the `https://developer.android.com/reference/android/view/ActionProvider`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/ActionProvider` | The action provider. This value may be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/ActionProvider`
- `https://developer.android.com/reference/android/view/MenuItem#setActionProvider(android.view.ActionProvider)`

### getActionView

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract View getActionView ()
```

Returns the currently set action view for this menu item.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/View` | This item's action view. This value may be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/MenuItem#setActionView(android.view.View)`
- `https://developer.android.com/reference/android/view/MenuItem#setShowAsAction(int)`

### getAlphabeticModifiers

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getAlphabeticModifiers ()
```

Return the modifier for this menu item's alphabetic shortcut. The modifier is a combination of `https://developer.android.com/reference/android/view/KeyEvent#META_META_ON`, `https://developer.android.com/reference/android/view/KeyEvent#META_CTRL_ON`, `https://developer.android.com/reference/android/view/KeyEvent#META_ALT_ON`, `https://developer.android.com/reference/android/view/KeyEvent#META_SHIFT_ON`, `https://developer.android.com/reference/android/view/KeyEvent#META_SYM_ON`, `https://developer.android.com/reference/android/view/KeyEvent#META_FUNCTION_ON`. For example, `https://developer.android.com/reference/android/view/KeyEvent#META_FUNCTION_ON`\|`https://developer.android.com/reference/android/view/KeyEvent#META_CTRL_ON`

<br />

| Returns ||
|---|---|
| `int` | Modifier associated with the keyboard shortcut. <br /> |

### getAlphabeticShortcut

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract char getAlphabeticShortcut ()
```

Return the char for this menu item's alphabetic shortcut.

<br />

| Returns ||
|---|---|
| `char` | Alphabetic character to use as a shortcut. <br /> |

### getContentDescription

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public CharSequence getContentDescription ()
```

Retrieve the content description associated with this menu item.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence` | The content description. This value may be `null`. <br /> |

### getGroupId

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract int getGroupId ()
```

Return the group identifier that this menu item is part of. The group identifier can not be changed after the menu is created.

<br />

| Returns ||
|---|---|
| `int` | The menu item's group identifier. <br /> |

### getIcon

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract Drawable getIcon ()
```

Returns the icon for this item as a Drawable (getting it from resources if it hasn't been loaded before). Note that if you call `https://developer.android.com/reference/android/view/MenuItem#setIconTintList(android.content.res.ColorStateList)` or `https://developer.android.com/reference/android/view/MenuItem#setIconTintMode(android.graphics.PorterDuff.Mode)` on this item, and you use a custom menu presenter in your application, you have to apply the tinting explicitly on the `https://developer.android.com/reference/android/graphics/drawable/Drawable` returned by this method.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/drawable/Drawable` | The icon as a Drawable. This value may be `null`. <br /> |

### getIconTintBlendMode

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public BlendMode getIconTintBlendMode ()
```

Returns the blending mode used to apply the tint to this item's icon, if specified.

<br />

**Related XML Attributes:**

- [android:iconTintMode](https://developer.android.com/reference/android/view/MenuItem#attr_android:iconTintMode)

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/BlendMode` | the blending mode used to apply the tint to this item's icon. This value may be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/MenuItem#setIconTintBlendMode(android.graphics.BlendMode)`

### getIconTintList

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ColorStateList getIconTintList ()
```

<br />

<br />

**Related XML Attributes:**

- [android:iconTint](https://developer.android.com/reference/android/view/MenuItem#attr_android:iconTint)

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/res/ColorStateList` | the tint applied to this item's icon. This value may be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/MenuItem#setIconTintList(android.content.res.ColorStateList)`

### getIconTintMode

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public PorterDuff.Mode getIconTintMode ()
```

Returns the blending mode used to apply the tint to this item's icon, if specified.

<br />

**Related XML Attributes:**

- [android:iconTintMode](https://developer.android.com/reference/android/view/MenuItem#attr_android:iconTintMode)

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/PorterDuff.Mode` | the blending mode used to apply the tint to this item's icon. This value may be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/MenuItem#setIconTintMode(android.graphics.PorterDuff.Mode)`
- `https://developer.android.com/reference/android/view/MenuItem#setIconTintBlendMode(android.graphics.BlendMode)`

### getIntent

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract Intent getIntent ()
```

Return the Intent associated with this item. This returns a reference to the Intent which you can change as desired to modify what the Item is holding.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/Intent` | Returns the last value supplied to `https://developer.android.com/reference/android/view/MenuItem#setIntent(android.content.Intent)`, or null. <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/MenuItem#setIntent(android.content.Intent)`

### getItemId

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract int getItemId ()
```

Return the identifier for this menu item. The identifier can not be changed after the menu is created.

<br />

| Returns ||
|---|---|
| `int` | The menu item's identifier. <br /> |

### getMenuInfo

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract ContextMenu.ContextMenuInfo getMenuInfo ()
```

Gets the extra information linked to this menu item. This extra information is set by the View that added this menu item to the menu.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/ContextMenu.ContextMenuInfo` | The extra information linked to the View that added this menu item to the menu. This can be null. <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/View.OnCreateContextMenuListener`

### getNumericModifiers

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getNumericModifiers ()
```

Return the modifiers for this menu item's numeric (12-key) shortcut. The modifier is a combination of `https://developer.android.com/reference/android/view/KeyEvent#META_META_ON`, `https://developer.android.com/reference/android/view/KeyEvent#META_CTRL_ON`, `https://developer.android.com/reference/android/view/KeyEvent#META_ALT_ON`, `https://developer.android.com/reference/android/view/KeyEvent#META_SHIFT_ON`, `https://developer.android.com/reference/android/view/KeyEvent#META_SYM_ON`, `https://developer.android.com/reference/android/view/KeyEvent#META_FUNCTION_ON`. For example, `https://developer.android.com/reference/android/view/KeyEvent#META_FUNCTION_ON`\|`https://developer.android.com/reference/android/view/KeyEvent#META_CTRL_ON`

<br />

| Returns ||
|---|---|
| `int` | Modifier associated with the numeric shortcut. <br /> |

### getNumericShortcut

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract char getNumericShortcut ()
```

Return the char for this menu item's numeric (12-key) shortcut.

<br />

| Returns ||
|---|---|
| `char` | Numeric character to use as a shortcut. <br /> |

### getOrder

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract int getOrder ()
```

Return the category and order within the category of this item. This item will be shown before all items (within its category) that have order greater than this value.

An order integer contains the item's category (the upper bits of the integer; set by or/add the category with the order within the category) and the ordering of the item within that category (the lower bits). Example categories are `https://developer.android.com/reference/android/view/Menu#CATEGORY_SYSTEM`, `https://developer.android.com/reference/android/view/Menu#CATEGORY_SECONDARY`, `https://developer.android.com/reference/android/view/Menu#CATEGORY_ALTERNATIVE`, `https://developer.android.com/reference/android/view/Menu#CATEGORY_CONTAINER`. See `https://developer.android.com/reference/android/view/Menu` for a full list.

<br />

| Returns ||
|---|---|
| `int` | The order of this item. <br /> |

### getSubMenu

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract SubMenu getSubMenu ()
```

Get the sub-menu to be invoked when this item is selected, if it has one. See `https://developer.android.com/reference/android/view/MenuItem#hasSubMenu()`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/SubMenu` | The associated menu if there is one, else null <br /> |

### getTitle

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract CharSequence getTitle ()
```

Retrieve the current title of the item.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence` | The title. This value may be `null`. <br /> |

### getTitleCondensed

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract CharSequence getTitleCondensed ()
```

Retrieve the current condensed title of the item. If a condensed title was never set, it will return the normal title.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence` | The condensed title, if it exists. Otherwise the normal title. This value may be `null`. <br /> |

### getTooltipText

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public CharSequence getTooltipText ()
```

Retrieve the tooltip text associated with this menu item.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence` | The tooltip text. This value may be `null`. <br /> |

### hasSubMenu

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract boolean hasSubMenu ()
```

Check whether this item has an associated sub-menu. I.e. it is a sub-menu of another menu.

<br />

| Returns ||
|---|---|
| `boolean` | If true this item has a menu; else it is a normal item. <br /> |

### isActionViewExpanded

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract boolean isActionViewExpanded ()
```

Returns true if this menu item's action view has been expanded.

<br />

| Returns ||
|---|---|
| `boolean` | true if the item's action view is expanded, false otherwise. <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/MenuItem#expandActionView()`
- `https://developer.android.com/reference/android/view/MenuItem#collapseActionView()`
- `https://developer.android.com/reference/android/view/MenuItem#SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW`
- `https://developer.android.com/reference/android/view/MenuItem.OnActionExpandListener`

### isCheckable

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract boolean isCheckable ()
```

Return whether the item can currently display a check mark.

<br />

| Returns ||
|---|---|
| `boolean` | If a check mark can be displayed, returns true. <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/MenuItem#setCheckable(boolean)`

### isChecked

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract boolean isChecked ()
```

Return whether the item is currently displaying a check mark.

<br />

| Returns ||
|---|---|
| `boolean` | If a check mark is displayed, returns true. <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/MenuItem#setChecked(boolean)`

### isEnabled

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract boolean isEnabled ()
```

Return the enabled state of the menu item.

<br />

| Returns ||
|---|---|
| `boolean` | If true the item is enabled and hence invokable; else it is not. <br /> |

### isVisible

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract boolean isVisible ()
```

Return the visibility of the menu item.

<br />

| Returns ||
|---|---|
| `boolean` | If true the item is visible; else it is hidden. <br /> |

### setActionProvider

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract MenuItem setActionProvider (ActionProvider actionProvider)
```

Sets the `https://developer.android.com/reference/android/view/ActionProvider` responsible for creating an action view if the item is placed on the action bar. The provider also provides a default action invoked if the item is placed in the overflow menu.

**Note:** Setting an action provider overrides the action view set via `https://developer.android.com/reference/android/view/MenuItem#setActionView(int)` or `https://developer.android.com/reference/android/view/MenuItem#setActionView(android.view.View)`.

<br />

<br />

| Parameters ||
|---|---|
| `actionProvider` | `ActionProvider`: The action provider. This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/MenuItem` | This Item so additional setters can be called. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/ActionProvider`

### setActionView

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract MenuItem setActionView (int resId)
```

Set an action view for this menu item. An action view will be displayed in place of an automatically generated menu item element in the UI when this item is shown as an action within a parent.

**Note:** Setting an action view overrides the action provider set via `https://developer.android.com/reference/android/view/MenuItem#setActionProvider(android.view.ActionProvider)`.

<br />

<br />

| Parameters ||
|---|---|
| `resId` | `int`: Layout resource to use for presenting this item to the user. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/MenuItem` | This Item so additional setters can be called. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/MenuItem#setShowAsAction(int)`

### setActionView

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract MenuItem setActionView (View view)
```

Set an action view for this menu item. An action view will be displayed in place of an automatically generated menu item element in the UI when this item is shown as an action within a parent.

**Note:** Setting an action view overrides the action provider set via `https://developer.android.com/reference/android/view/MenuItem#setActionProvider(android.view.ActionProvider)`.

<br />

<br />

| Parameters ||
|---|---|
| `view` | `View`: View to use for presenting this item to the user. This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/MenuItem` | This Item so additional setters can be called. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/MenuItem#setShowAsAction(int)`

### setAlphabeticShortcut

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract MenuItem setAlphabeticShortcut (char alphaChar)
```

Change the alphabetic shortcut associated with this item. The shortcut will be triggered when the key that generates the given character is pressed along with the corresponding modifier key. The default modifier is `https://developer.android.com/reference/android/view/KeyEvent#META_CTRL_ON` in case nothing is specified. Case is not significant and shortcut characters will be displayed in lower case. Note that menu items with the characters '\\b' or '\\n' as shortcuts will get triggered by the Delete key or Carriage Return key, respectively.

See `https://developer.android.com/reference/android/view/Menu` for the menu types that support shortcuts.

<br />

| Parameters ||
|---|---|
| `alphaChar` | `char`: The alphabetic shortcut key. This is the shortcut when using a keyboard with alphabetic keys. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/MenuItem` | This Item so additional setters can be called. This value cannot be `null`. <br /> |

### setAlphabeticShortcut

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public MenuItem setAlphabeticShortcut (char alphaChar, 
                int alphaModifiers)
```

Change the alphabetic shortcut associated with this item. The shortcut will be triggered when the key that generates the given character is pressed along with the modifier keys. Case is not significant and shortcut characters will be displayed in lower case. Note that menu items with the characters '\\b' or '\\n' as shortcuts will get triggered by the Delete key or Carriage Return key, respectively.

See `https://developer.android.com/reference/android/view/Menu` for the menu types that support shortcuts.

<br />

| Parameters ||
|---|---|
| `alphaChar` | `char`: The alphabetic shortcut key. This is the shortcut when using a keyboard with alphabetic keys. <br /> |
| `alphaModifiers` | `int`: The modifier associated with the shortcut. It should be a combination of `https://developer.android.com/reference/android/view/KeyEvent#META_META_ON`, `https://developer.android.com/reference/android/view/KeyEvent#META_CTRL_ON`, `https://developer.android.com/reference/android/view/KeyEvent#META_ALT_ON`, `https://developer.android.com/reference/android/view/KeyEvent#META_SHIFT_ON`, `https://developer.android.com/reference/android/view/KeyEvent#META_SYM_ON`, `https://developer.android.com/reference/android/view/KeyEvent#META_FUNCTION_ON`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/MenuItem` | This Item so additional setters can be called. This value cannot be `null`. <br /> |

### setCheckable

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract MenuItem setCheckable (boolean checkable)
```

Control whether this item can display a check mark. Setting this does not actually display a check mark (see `https://developer.android.com/reference/android/view/MenuItem#setChecked(boolean)` for that); rather, it ensures there is room in the item in which to display a check mark.

See `https://developer.android.com/reference/android/view/Menu` for the menu types that support check marks.

<br />

| Parameters ||
|---|---|
| `checkable` | `boolean`: Set to true to allow a check mark, false to disallow. The default is false. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/MenuItem` | This Item so additional setters can be called. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/MenuItem#setChecked(boolean)`
- `https://developer.android.com/reference/android/view/MenuItem#isCheckable()`
- `https://developer.android.com/reference/android/view/Menu#setGroupCheckable(int,%20boolean,%20boolean)`

### setChecked

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract MenuItem setChecked (boolean checked)
```

Control whether this item is shown with a check mark. Note that you must first have enabled checking with `https://developer.android.com/reference/android/view/MenuItem#setCheckable(boolean)` or else the check mark will not appear. If this item is a member of a group that contains mutually-exclusive items (set via `https://developer.android.com/reference/android/view/Menu#setGroupCheckable(int,%20boolean,%20boolean)`, the other items in the group will be unchecked.

See `https://developer.android.com/reference/android/view/Menu` for the menu types that support check marks.

<br />

| Parameters ||
|---|---|
| `checked` | `boolean`: Set to true to display a check mark, false to hide it. The default value is false. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/MenuItem` | This Item so additional setters can be called. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/MenuItem#setCheckable(boolean)`
- `https://developer.android.com/reference/android/view/MenuItem#isChecked()`
- `https://developer.android.com/reference/android/view/Menu#setGroupCheckable(int,%20boolean,%20boolean)`

### setContentDescription

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public MenuItem setContentDescription (CharSequence contentDescription)
```

Change the content description associated with this menu item.

<br />

| Parameters ||
|---|---|
| `contentDescription` | `CharSequence`: The new content description. This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/MenuItem` | This value cannot be `null`. <br /> |

### setEnabled

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract MenuItem setEnabled (boolean enabled)
```

Sets whether the menu item is enabled. Disabling a menu item will not allow it to be invoked via its shortcut. The menu item will still be visible.

<br />

| Parameters ||
|---|---|
| `enabled` | `boolean`: If true then the item will be invokable; if false it is won't be invokable. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/MenuItem` | This Item so additional setters can be called. This value cannot be `null`. <br /> |

### setIcon

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract MenuItem setIcon (Drawable icon)
```

Change the icon associated with this item. This icon will not always be shown, so the title should be sufficient in describing this item. See `https://developer.android.com/reference/android/view/Menu` for the menu types that support icons.

<br />

| Parameters ||
|---|---|
| `icon` | `Drawable`: The new icon (as a Drawable) to be displayed. This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/MenuItem` | This Item so additional setters can be called. This value cannot be `null`. <br /> |

### setIcon

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract MenuItem setIcon (int iconRes)
```

Change the icon associated with this item. This icon will not always be shown, so the title should be sufficient in describing this item. See `https://developer.android.com/reference/android/view/Menu` for the menu types that support icons.

This method will set the resource ID of the icon which will be used to lazily get the Drawable when this item is being shown.

<br />

| Parameters ||
|---|---|
| `iconRes` | `int`: The new icon (as a resource ID) to be displayed. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/MenuItem` | This Item so additional setters can be called. This value cannot be `null`. <br /> |

### setIconTintBlendMode

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public MenuItem setIconTintBlendMode (BlendMode blendMode)
```

Specifies the blending mode used to apply the tint specified by `https://developer.android.com/reference/android/view/MenuItem#setIconTintList(android.content.res.ColorStateList)` to this item's icon. The default mode is `https://developer.android.com/reference/android/graphics/BlendMode#SRC_IN`.

<br />

**Related XML Attributes:**

- [android:iconTintMode](https://developer.android.com/reference/android/view/MenuItem#attr_android:iconTintMode)

| Parameters ||
|---|---|
| `blendMode` | `BlendMode`: the blending mode used to apply the tint, may be `null` to clear tint <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/MenuItem` | This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/MenuItem#setIconTintList(android.content.res.ColorStateList)`

### setIconTintList

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public MenuItem setIconTintList (ColorStateList tint)
```

Applies a tint to this item's icon. Does not modify the current tint mode, which is `https://developer.android.com/reference/android/graphics/PorterDuff.Mode#SRC_IN` by default.

Subsequent calls to `https://developer.android.com/reference/android/view/MenuItem#setIcon(android.graphics.drawable.Drawable)` or `https://developer.android.com/reference/android/view/MenuItem#setIcon(int)` will automatically mutate the icon and apply the specified tint and tint mode using `https://developer.android.com/reference/android/graphics/drawable/Drawable#setTintList(android.content.res.ColorStateList)`.

<br />

**Related XML Attributes:**

- [android:iconTint](https://developer.android.com/reference/android/view/MenuItem#attr_android:iconTint)

| Parameters ||
|---|---|
| `tint` | `ColorStateList`: the tint to apply, may be `null` to clear tint <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/MenuItem` | This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/MenuItem#getIconTintList()`
- `https://developer.android.com/reference/android/graphics/drawable/Drawable#setTintList(android.content.res.ColorStateList)`

### setIconTintMode

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public MenuItem setIconTintMode (PorterDuff.Mode tintMode)
```

Specifies the blending mode used to apply the tint specified by `https://developer.android.com/reference/android/view/MenuItem#setIconTintList(android.content.res.ColorStateList)` to this item's icon. The default mode is `https://developer.android.com/reference/android/graphics/PorterDuff.Mode#SRC_IN`.

<br />

**Related XML Attributes:**

- [android:iconTintMode](https://developer.android.com/reference/android/view/MenuItem#attr_android:iconTintMode)

| Parameters ||
|---|---|
| `tintMode` | `PorterDuff.Mode`: the blending mode used to apply the tint, may be `null` to clear tint <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/MenuItem` | This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/MenuItem#setIconTintList(android.content.res.ColorStateList)`
- `https://developer.android.com/reference/android/graphics/drawable/Drawable#setTintMode(android.graphics.PorterDuff.Mode)`
- `https://developer.android.com/reference/android/graphics/drawable/Drawable#setTintBlendMode(android.graphics.BlendMode)`

### setIntent

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract MenuItem setIntent (Intent intent)
```

Change the Intent associated with this item. By default there is no Intent associated with a menu item. If you set one, and nothing else handles the item, then the default behavior will be to call `https://developer.android.com/reference/android/content/Context#startActivity(android.content.Intent)` with the given Intent.

Note that setIntent() can not be used with the versions of `https://developer.android.com/reference/android/view/Menu#add(int)` that take a Runnable, because `https://developer.android.com/reference/java/lang/Runnable#run()` does not return a value so there is no way to tell if it handled the item. In this case it is assumed that the Runnable always handles the item, and the intent will never be started.

<br />

| Parameters ||
|---|---|
| `intent` | `Intent`: The Intent to associated with the item. This Intent object is *not* copied, so be careful not to modify it later. This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/MenuItem` | This Item so additional setters can be called. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/MenuItem#getIntent()`

### setNumericShortcut

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public MenuItem setNumericShortcut (char numericChar, 
                int numericModifiers)
```

Change the numeric shortcut and modifiers associated with this item.

See `https://developer.android.com/reference/android/view/Menu` for the menu types that support shortcuts.

<br />

| Parameters ||
|---|---|
| `numericChar` | `char`: The numeric shortcut key. This is the shortcut when using a 12-key (numeric) keyboard. <br /> |
| `numericModifiers` | `int`: The modifier associated with the shortcut. It should be a combination of `https://developer.android.com/reference/android/view/KeyEvent#META_META_ON`, `https://developer.android.com/reference/android/view/KeyEvent#META_CTRL_ON`, `https://developer.android.com/reference/android/view/KeyEvent#META_ALT_ON`, `https://developer.android.com/reference/android/view/KeyEvent#META_SHIFT_ON`, `https://developer.android.com/reference/android/view/KeyEvent#META_SYM_ON`, `https://developer.android.com/reference/android/view/KeyEvent#META_FUNCTION_ON`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/MenuItem` | This Item so additional setters can be called. This value cannot be `null`. <br /> |

### setNumericShortcut

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract MenuItem setNumericShortcut (char numericChar)
```

Change the numeric shortcut associated with this item.

See `https://developer.android.com/reference/android/view/Menu` for the menu types that support shortcuts.

<br />

| Parameters ||
|---|---|
| `numericChar` | `char`: The numeric shortcut key. This is the shortcut when using a 12-key (numeric) keyboard. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/MenuItem` | This Item so additional setters can be called. This value cannot be `null`. <br /> |

### setOnActionExpandListener

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract MenuItem setOnActionExpandListener (MenuItem.OnActionExpandListener listener)
```

Set an `https://developer.android.com/reference/android/view/MenuItem.OnActionExpandListener` on this menu item to be notified when the associated action view is expanded or collapsed. The menu item must be configured to expand or collapse its action view using the flag `https://developer.android.com/reference/android/view/MenuItem#SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW`.

<br />

| Parameters ||
|---|---|
| `listener` | `MenuItem.OnActionExpandListener`: Listener that will respond to expand/collapse events. This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/MenuItem` | This menu item instance for call chaining. This value cannot be `null`. <br /> |

### setOnMenuItemClickListener

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract MenuItem setOnMenuItemClickListener (MenuItem.OnMenuItemClickListener menuItemClickListener)
```

Set a custom listener for invocation of this menu item. In most situations, it is more efficient and easier to use `https://developer.android.com/reference/android/app/Activity#onOptionsItemSelected(android.view.MenuItem)` or `https://developer.android.com/reference/android/app/Activity#onContextItemSelected(android.view.MenuItem)`.

<br />

| Parameters ||
|---|---|
| `menuItemClickListener` | `MenuItem.OnMenuItemClickListener`: The object to receive invokations. This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/MenuItem` | This Item so additional setters can be called. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/app/Activity#onOptionsItemSelected(android.view.MenuItem)`
- `https://developer.android.com/reference/android/app/Activity#onContextItemSelected(android.view.MenuItem)`

### setShortcut

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract MenuItem setShortcut (char numericChar, 
                char alphaChar)
```

Change both the numeric and alphabetic shortcut associated with this item. Note that the shortcut will be triggered when the key that generates the given character is pressed along with the corresponding modifier key. The default modifier is `https://developer.android.com/reference/android/view/KeyEvent#META_CTRL_ON` in case nothing is specified. Also note that case is not significant and that alphabetic shortcut characters will be handled in lower case.

See `https://developer.android.com/reference/android/view/Menu` for the menu types that support shortcuts.

<br />

| Parameters ||
|---|---|
| `numericChar` | `char`: The numeric shortcut key. This is the shortcut when using a numeric (e.g., 12-key) keyboard. <br /> |
| `alphaChar` | `char`: The alphabetic shortcut key. This is the shortcut when using a keyboard with alphabetic keys. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/MenuItem` | This Item so additional setters can be called. This value cannot be `null`. <br /> |

### setShortcut

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public MenuItem setShortcut (char numericChar, 
                char alphaChar, 
                int numericModifiers, 
                int alphaModifiers)
```

Change both the numeric and alphabetic shortcut associated with this item. Note that the shortcut will be triggered when the key that generates the given character is pressed along with the corresponding modifier key. Also note that case is not significant and that alphabetic shortcut characters will be handled in lower case.

See `https://developer.android.com/reference/android/view/Menu` for the menu types that support shortcuts.

<br />

| Parameters ||
|---|---|
| `numericChar` | `char`: The numeric shortcut key. This is the shortcut when using a numeric (e.g., 12-key) keyboard. <br /> |
| `alphaChar` | `char`: The alphabetic shortcut key. This is the shortcut when using a keyboard with alphabetic keys. <br /> |
| `numericModifiers` | `int`: The numeric modifier associated with the shortcut. It should be a combination of `https://developer.android.com/reference/android/view/KeyEvent#META_META_ON`, `https://developer.android.com/reference/android/view/KeyEvent#META_CTRL_ON`, `https://developer.android.com/reference/android/view/KeyEvent#META_ALT_ON`, `https://developer.android.com/reference/android/view/KeyEvent#META_SHIFT_ON`, `https://developer.android.com/reference/android/view/KeyEvent#META_SYM_ON`, `https://developer.android.com/reference/android/view/KeyEvent#META_FUNCTION_ON`. <br /> |
| `alphaModifiers` | `int`: The alphabetic modifier associated with the shortcut. It should be a combination of `https://developer.android.com/reference/android/view/KeyEvent#META_META_ON`, `https://developer.android.com/reference/android/view/KeyEvent#META_CTRL_ON`, `https://developer.android.com/reference/android/view/KeyEvent#META_ALT_ON`, `https://developer.android.com/reference/android/view/KeyEvent#META_SHIFT_ON`, `https://developer.android.com/reference/android/view/KeyEvent#META_SYM_ON`, `https://developer.android.com/reference/android/view/KeyEvent#META_FUNCTION_ON`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/MenuItem` | This Item so additional setters can be called. This value cannot be `null`. <br /> |

### setShowAsAction

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void setShowAsAction (int actionEnum)
```

Sets how this item should display in the presence of an Action Bar. The parameter actionEnum is a flag set. One of `https://developer.android.com/reference/android/view/MenuItem#SHOW_AS_ACTION_ALWAYS`, `https://developer.android.com/reference/android/view/MenuItem#SHOW_AS_ACTION_IF_ROOM`, or `https://developer.android.com/reference/android/view/MenuItem#SHOW_AS_ACTION_NEVER` should be used, and you may optionally OR the value with `https://developer.android.com/reference/android/view/MenuItem#SHOW_AS_ACTION_WITH_TEXT`. SHOW_AS_ACTION_WITH_TEXT requests that when the item is shown as an action, it should be shown with a text label.

<br />

| Parameters ||
|---|---|
| `actionEnum` | `int`: How the item should display. One of `https://developer.android.com/reference/android/view/MenuItem#SHOW_AS_ACTION_ALWAYS`, `https://developer.android.com/reference/android/view/MenuItem#SHOW_AS_ACTION_IF_ROOM`, or `https://developer.android.com/reference/android/view/MenuItem#SHOW_AS_ACTION_NEVER`. SHOW_AS_ACTION_NEVER is the default. <br /> |

**See also:**

- `https://developer.android.com/reference/android/app/ActionBar`
- `https://developer.android.com/reference/android/view/MenuItem#setActionView(android.view.View)`

### setShowAsActionFlags

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract MenuItem setShowAsActionFlags (int actionEnum)
```

Sets how this item should display in the presence of an Action Bar. The parameter actionEnum is a flag set. One of `https://developer.android.com/reference/android/view/MenuItem#SHOW_AS_ACTION_ALWAYS`, `https://developer.android.com/reference/android/view/MenuItem#SHOW_AS_ACTION_IF_ROOM`, or `https://developer.android.com/reference/android/view/MenuItem#SHOW_AS_ACTION_NEVER` should be used, and you may optionally OR the value with `https://developer.android.com/reference/android/view/MenuItem#SHOW_AS_ACTION_WITH_TEXT`. SHOW_AS_ACTION_WITH_TEXT requests that when the item is shown as an action, it should be shown with a text label.

Note: This method differs from `https://developer.android.com/reference/android/view/MenuItem#setShowAsAction(int)` only in that it returns the current MenuItem instance for call chaining.

<br />

| Parameters ||
|---|---|
| `actionEnum` | `int`: How the item should display. One of `https://developer.android.com/reference/android/view/MenuItem#SHOW_AS_ACTION_ALWAYS`, `https://developer.android.com/reference/android/view/MenuItem#SHOW_AS_ACTION_IF_ROOM`, or `https://developer.android.com/reference/android/view/MenuItem#SHOW_AS_ACTION_NEVER`. SHOW_AS_ACTION_NEVER is the default. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/MenuItem` | This MenuItem instance for call chaining. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/app/ActionBar`
- `https://developer.android.com/reference/android/view/MenuItem#setActionView(android.view.View)`

### setTitle

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract MenuItem setTitle (CharSequence title)
```

Change the title associated with this item.

<br />

| Parameters ||
|---|---|
| `title` | `CharSequence`: The new text to be displayed. This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/MenuItem` | This Item so additional setters can be called. This value cannot be `null`. <br /> |

### setTitle

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract MenuItem setTitle (int title)
```

Change the title associated with this item.

Some menu types do not sufficient space to show the full title, and instead a condensed title is preferred. See `https://developer.android.com/reference/android/view/Menu` for more information.

<br />

| Parameters ||
|---|---|
| `title` | `int`: The resource id of the new text to be displayed. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/MenuItem` | This Item so additional setters can be called. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/MenuItem#setTitleCondensed(java.lang.CharSequence)`

### setTitleCondensed

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract MenuItem setTitleCondensed (CharSequence title)
```

Change the condensed title associated with this item. The condensed title is used in situations where the normal title may be too long to be displayed.

<br />

| Parameters ||
|---|---|
| `title` | `CharSequence`: The new text to be displayed as the condensed title. This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/MenuItem` | This Item so additional setters can be called. This value cannot be `null`. <br /> |

### setTooltipText

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public MenuItem setTooltipText (CharSequence tooltipText)
```

Change the tooltip text associated with this menu item.

<br />

| Parameters ||
|---|---|
| `tooltipText` | `CharSequence`: The new tooltip text. This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/MenuItem` | This value cannot be `null`. <br /> |

### setVisible

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract MenuItem setVisible (boolean visible)
```

Sets the visibility of the menu item. Even if a menu item is not visible, it may still be invoked via its shortcut (to completely disable an item, set it to invisible and `https://developer.android.com/reference/android/view/MenuItem#setEnabled(boolean)`).

<br />

| Parameters ||
|---|---|
| `visible` | `boolean`: If true then the item will be visible; if false it is hidden. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/MenuItem` | This Item so additional setters can be called. This value cannot be `null`. <br /> |