Skip to content

Most visited

Recently visited

navigation
added in version 22.1.0
belongs to Maven artifact com.android.support:appcompat-v7:27.0.0

ActionMode.Callback

public static interface ActionMode.Callback

android.support.v7.view.ActionMode.Callback


Callback interface for action modes. Supplied to startSupportActionMode(Callback) (Callback)}, a Callback configures and handles events raised by a user's interaction with an action mode.

An action mode's lifecycle is as follows:

Summary

Public methods

abstract boolean onActionItemClicked(ActionMode mode, MenuItem item)

Called to report a user click on an action button.

abstract boolean onCreateActionMode(ActionMode mode, Menu menu)

Called when action mode is first created.

abstract void onDestroyActionMode(ActionMode mode)

Called when an action mode is about to be exited and destroyed.

abstract boolean onPrepareActionMode(ActionMode mode, Menu menu)

Called to refresh an action mode's action menu whenever it is invalidated.

Public methods

onActionItemClicked

added in version 22.1.0
boolean onActionItemClicked (ActionMode mode, 
                MenuItem item)

Called to report a user click on an action button.

Parameters
mode ActionMode: The current ActionMode

item MenuItem: The item that was clicked

Returns
boolean true if this callback handled the event, false if the standard MenuItem invocation should continue.

onCreateActionMode

added in version 22.1.0
boolean onCreateActionMode (ActionMode mode, 
                Menu menu)

Called when action mode is first created. The menu supplied will be used to generate action buttons for the action mode.

Parameters
mode ActionMode: ActionMode being created

menu Menu: Menu used to populate action buttons

Returns
boolean true if the action mode should be created, false if entering this mode should be aborted.

onDestroyActionMode

added in version 22.1.0
void onDestroyActionMode (ActionMode mode)

Called when an action mode is about to be exited and destroyed.

Parameters
mode ActionMode: The current ActionMode being destroyed

onPrepareActionMode

added in version 22.1.0
boolean onPrepareActionMode (ActionMode mode, 
                Menu menu)

Called to refresh an action mode's action menu whenever it is invalidated.

Parameters
mode ActionMode: ActionMode being prepared

menu Menu: Menu used to populate action buttons

Returns
boolean true if the menu or action mode was updated, false otherwise.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)