IMenu.AddIntentOptions Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Add a group of menu items corresponding to actions that can be performed for a particular Intent.
[Android.Runtime.Register("addIntentOptions", "(IIILandroid/content/ComponentName;[Landroid/content/Intent;Landroid/content/Intent;I[Landroid/view/MenuItem;)I", "GetAddIntentOptions_IIILandroid_content_ComponentName_arrayLandroid_content_Intent_Landroid_content_Intent_IarrayLandroid_view_MenuItem_Handler:Android.Views.IMenuInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public int AddIntentOptions (int groupId, int itemId, int order, Android.Content.ComponentName? caller, Android.Content.Intent[]? specifics, Android.Content.Intent? intent, Android.Views.MenuAppendFlags flags, Android.Views.IMenuItem[]? outSpecificItems);
[<Android.Runtime.Register("addIntentOptions", "(IIILandroid/content/ComponentName;[Landroid/content/Intent;Landroid/content/Intent;I[Landroid/view/MenuItem;)I", "GetAddIntentOptions_IIILandroid_content_ComponentName_arrayLandroid_content_Intent_Landroid_content_Intent_IarrayLandroid_view_MenuItem_Handler:Android.Views.IMenuInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member AddIntentOptions : int * int * int * Android.Content.ComponentName * Android.Content.Intent[] * Android.Content.Intent * Android.Views.MenuAppendFlags * Android.Views.IMenuItem[] -> int
Parameters
- groupId
- Int32
The group identifier that the items should be part of.
This can also be used to define groups of items for batch state
changes. Normally use #NONE
if the items should not be in
a group.
- itemId
- Int32
Unique item ID. Use #NONE
if you do not need a
unique ID.
- order
- Int32
The order for the items. Use #NONE
if you do not
care about the order. See MenuItem#getOrder()
.
- caller
- ComponentName
The current activity component name as defined by queryIntentActivityOptions().
- specifics
- Intent[]
Specific items to place first as defined by queryIntentActivityOptions().
- intent
- Intent
Intent describing the kinds of items to populate in the list as defined by queryIntentActivityOptions().
- flags
- MenuAppendFlags
Additional options controlling how the items are added.
- outSpecificItems
- IMenuItem[]
Optional array in which to place the menu items that were generated for each of the <var>specifics</var> that were requested. Entries may be null if no activity was found for that specific action.
Returns
The number of menu items that were added.
- Attributes
Remarks
Add a group of menu items corresponding to actions that can be performed for a particular Intent. The Intent is most often configured with a null action, the data that the current activity is working with, and includes either the Intent#CATEGORY_ALTERNATIVE
or Intent#CATEGORY_SELECTED_ALTERNATIVE
to find activities that have said they would like to be included as optional action. You can, however, use any Intent you want.
See android.content.pm.PackageManager#queryIntentActivityOptions
for more * details on the <var>caller</var>, <var>specifics</var>, and <var>intent</var> arguments. The list returned by that function is used to populate the resulting menu items.
All of the menu items of possible options for the intent will be added with the given group and id. You can use the group to control ordering of the items in relation to other items in the menu. Normally this function will automatically remove any existing items in the menu in the same group and place a divider above and below the added items; this behavior can be modified with the <var>flags</var> parameter. For each of the generated items MenuItem#setIntent
is called to associate the appropriate Intent with the item; this means the activity will automatically be started for you without having to do anything else.
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
- SetIntent(Intent)
- <xref:Android.Content.PM.PackageManager.QueryIntentActivityOptions(Android.Content.ComponentName%2c+Android.Content.Intent%5b%5d%2c+Android.Content.Intent%5b%5d%2c+Android.Content.Intent%5b%5d)>