to top
Android APIs
Added in API level 11
public static interface

ActionMode.Callback

android.view.ActionMode.Callback
Known Indirect Subclasses

Class Overview

Callback interface for action modes. Supplied to startActionMode(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

? Examples
abstract boolean onActionItemClicked( ActionMode mode, MenuItem item)
Called to report a user click on an action button.

? Examples
abstract boolean onCreateActionMode( ActionMode mode, Menu menu)
Called when action mode is first created.

? Examples
abstract void onDestroyActionMode( ActionMode mode)
Called when an action mode is about to be exited and destroyed.

? Examples
abstract boolean onPrepareActionMode( ActionMode mode, Menu menu)
Called to refresh an action mode's action menu whenever it is invalidated.

Public Methods

public abstract boolean onActionItemClicked (ActionMode mode, MenuItem item)

Added in API level 11

Called to report a user click on an action button.

Parameters
mode The current ActionMode
item The item that was clicked
Returns
  • true if this callback handled the event, false if the standard MenuItem invocation should continue.

public abstract boolean onCreateActionMode (ActionMode mode, Menu menu)

Added in API level 11

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

Parameters
mode ActionMode being created
menu Menu used to populate action buttons
Returns
  • true if the action mode should be created, false if entering this mode should be aborted.

public abstract void onDestroyActionMode (ActionMode mode)

Added in API level 11

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

Parameters
mode The current ActionMode being destroyed

public abstract boolean onPrepareActionMode (ActionMode mode, Menu menu)

Added in API level 11

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

Parameters
mode ActionMode being prepared
menu Menu used to populate action buttons
Returns
  • true if the menu or action mode was updated, false otherwise.
No examples for this method.
Frequently called with: [Clear]
Portions of this page are reproduced from work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License. The original page is available here.