IMenuItem.SetIntent(Intent) Method

Definition

Change the Intent associated with this item.

[Android.Runtime.Register("setIntent", "(Landroid/content/Intent;)Landroid/view/MenuItem;", "GetSetIntent_Landroid_content_Intent_Handler:Android.Views.IMenuItemInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public Android.Views.IMenuItem SetIntent (Android.Content.Intent? intent);
[<Android.Runtime.Register("setIntent", "(Landroid/content/Intent;)Landroid/view/MenuItem;", "GetSetIntent_Landroid_content_Intent_Handler:Android.Views.IMenuItemInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member SetIntent : Android.Content.Intent -> Android.Views.IMenuItem

Parameters

intent
Intent

The Intent to associated with the item. This Intent object is <em>not</em> copied, so be careful not to modify it later.

Returns

This Item so additional setters can be called.

Attributes

Remarks

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 android.content.Context#startActivity with the given Intent.

Note that setIntent() can not be used with the versions of Menu#add that take a Runnable, because 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.

Java documentation for android.view.MenuItem.setIntent(android.content.Intent).

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

See also