ActionMode.Callback


interface ActionMode.Callback


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

Boolean

Called to report a user click on an action button.

Boolean

Called when action mode is first created.

Unit

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

Boolean

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

Public functions

onActionItemClicked

Added in 1.1.0
fun onActionItemClicked(mode: ActionMode!, item: MenuItem!): Boolean

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 1.1.0
fun onCreateActionMode(mode: ActionMode!, menu: Menu!): Boolean

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 1.1.0
fun onDestroyActionMode(mode: ActionMode!): Unit

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

Parameters
mode: ActionMode!

The current ActionMode being destroyed

onPrepareActionMode

Added in 1.1.0
fun onPrepareActionMode(mode: ActionMode!, menu: Menu!): Boolean

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.