# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Nested Classes | Constants | Ctors | Methods | Inherited Methods

# ActionMode

`public abstract class ActionMode`
`extends Object` ``

java.lang.Object
↳ | android.view.ActionMode

Represents a contextual mode of the user interface. Action modes can be used to provide alternative interaction modes and replace parts of the normal UI until finished. Examples of good action modes include text selection and contextual actions.

### Developer Guides

For information about how to provide contextual actions with `ActionMode`, read the Menus developer guide.

## Summary

### Nested classes
`interface` | `ActionMode.Callback` Callback interface for action modes.
`class` | `ActionMode.Callback2` Extension of `ActionMode.Callback` to provide content rect information.

### Constants
`int` | `DEFAULT_HIDE_DURATION` Default value to hide the action mode for `ViewConfiguration#getDefaultActionModeHideDuration()`.
`int` | `TYPE_FLOATING` The action mode is treated as a Floating Toolbar.
`int` | `TYPE_PRIMARY` The action mode is treated as a Primary mode.

### Public constructors
`ActionMode()`

### Public methods
`abstract void` | `finish()` Finish and close this action mode.
`abstract View` | `getCustomView()` Returns the current custom view for this action mode.
`abstract Menu` | `getMenu()` Returns the menu of actions that this action mode presents.
`abstract MenuInflater` | `getMenuInflater()` Returns a `MenuInflater` with the ActionMode's context.
`abstract CharSequence` | `getSubtitle()` Returns the current subtitle of this action mode.
`Object` | `getTag()` Retrieve the tag object associated with this ActionMode.
`abstract CharSequence` | `getTitle()` Returns the current title of this action mode.
`boolean` | `getTitleOptionalHint()`
`int` | `getType()` Returns the type for this action mode.
`void` | `hide(long duration)` Hide the action mode view from obstructing the content below for a short duration.
`abstract void` | `invalidate()` Invalidate the action mode and refresh menu content.
`void` | `invalidateContentRect()` Invalidate the content rect associated to this ActionMode.
`boolean` | `isTitleOptional()`
`void` | `onWindowFocusChanged(boolean hasWindowFocus)` Called when the window containing the view that started this action mode gains or loses focus.
`abstract void` | `setCustomView(View view)` Set a custom view for this action mode.
`abstract void` | `setSubtitle(CharSequence subtitle)` Set the subtitle of the action mode.
`abstract void` | `setSubtitle(int resId)` Set the subtitle of the action mode.
`void` | `setTag(Object tag)` Set a tag object associated with this ActionMode.
`abstract void` | `setTitle(CharSequence title)` Set the title of the action mode.
`abstract void` | `setTitle(int resId)` Set the title of the action mode.
`void` | `setTitleOptionalHint(boolean titleOptional)` Set whether or not the title/subtitle display for this action mode is optional.
`void` | `setType(int type)` Set a type for this action mode.

### Inherited methods
From class `java.lang.Object`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.

## Constants

### DEFAULT_HIDE_DURATION

    public static final int DEFAULT_HIDE_DURATION

Default value to hide the action mode for `ViewConfiguration#getDefaultActionModeHideDuration()`.

Constant Value: -1 (0xffffffff)

### TYPE_FLOATING

    public static final int TYPE_FLOATING

The action mode is treated as a Floating Toolbar. Use with `setType(int)`.

Constant Value: 1 (0x00000001)

### TYPE_PRIMARY

    public static final int TYPE_PRIMARY

The action mode is treated as a Primary mode. This is the default. Use with `setType(int)`.

Constant Value: 0 (0x00000000)

## Public constructors

### ActionMode

    public ActionMode ()

## Public methods

### finish

    public abstract void finish ()

Finish and close this action mode. The action mode's `ActionMode.Callback` will have its `Callback#onDestroyActionMode(ActionMode)` method called.

### getCustomView

    public abstract View getCustomView ()

Returns the current custom view for this action mode.

Returns
`View` | The current custom view

### getMenu

    public abstract Menu getMenu ()

Returns the menu of actions that this action mode presents.

Returns
`Menu` | The action mode's menu.

### getMenuInflater

    public abstract MenuInflater getMenuInflater ()

Returns a `MenuInflater` with the ActionMode's context.

Returns
`MenuInflater` |

### getSubtitle

    public abstract CharSequence getSubtitle ()

Returns the current subtitle of this action mode.

Returns
`CharSequence` | Subtitle text

### getTag

    public Object getTag ()

Retrieve the tag object associated with this ActionMode.

Like the tag available to views, this allows applications to associate arbitrary data with an ActionMode for later reference.

Returns
`Object` | Tag associated with this ActionMode

See also:

- `setTag(Object)`

### getTitle

    public abstract CharSequence getTitle ()

Returns the current title of this action mode.

Returns
`CharSequence` | Title text

### getTitleOptionalHint

    public boolean getTitleOptionalHint ()

Returns
`boolean` | true if this action mode has been given a hint to consider the title/subtitle display to be optional.

See also:

- `setTitleOptionalHint(boolean)`
- `isTitleOptional()`

### getType

    public int getType ()

Returns the type for this action mode.

Returns
`int` | One of `TYPE_PRIMARY` or `TYPE_FLOATING`.

### hide

    public void hide (long duration)

Hide the action mode view from obstructing the content below for a short duration. This only makes sense for action modes that support dynamic positioning on the screen. If this method is called again before the hide duration expires, the later hide call will cancel the former and then take effect. NOTE that there is an internal limit to how long the mode can be hidden for. It's typically about a few seconds.

Parameters
`duration` | `long`: The number of milliseconds to hide for.

See also:

- `DEFAULT_HIDE_DURATION`

### invalidate

    public abstract void invalidate ()

Invalidate the action mode and refresh menu content. The mode's `ActionMode.Callback` will have its `Callback#onPrepareActionMode(ActionMode, Menu)` method called. If it returns true the menu will be scanned for updated content and any relevant changes will be reflected to the user.

### invalidateContentRect

    public void invalidateContentRect ()

Invalidate the content rect associated to this ActionMode. This only makes sense for action modes that support dynamic positioning on the screen, and provides a more efficient way to reposition it without invalidating the whole action mode.

See also:

- `.`

### isTitleOptional

    public boolean isTitleOptional ()

Returns
`boolean` | true if this action mode considers the title and subtitle fields as optional. Optional titles may not be displayed to the user.

### onWindowFocusChanged

    public void onWindowFocusChanged (boolean hasWindowFocus)

Called when the window containing the view that started this action mode gains or loses focus.

Parameters
`hasWindowFocus` | `boolean`: True if the window containing the view that started this action mode now has focus, false otherwise.

### setCustomView

    public abstract void setCustomView (View view)

Set a custom view for this action mode. The custom view will take the place of the title and subtitle. Useful for things like search boxes.

Parameters
`view` | `View`: Custom view to use in place of the title/subtitle.

See also:

- `setTitle(CharSequence)`
- `setSubtitle(CharSequence)`

### setSubtitle

    public abstract void setSubtitle (CharSequence subtitle)

Set the subtitle of the action mode. This method will have no visible effect if a custom view has been set.

Parameters
`subtitle` | `CharSequence`: Subtitle string to set

See also:

- `setSubtitle(int)`
- `setCustomView(View)`

### setSubtitle

    public abstract void setSubtitle (int resId)

Set the subtitle of the action mode. This method will have no visible effect if a custom view has been set.

Parameters
`resId` | `int`: Resource ID of a string to set as the subtitle

See also:

- `setSubtitle(CharSequence)`
- `setCustomView(View)`

### setTag

    public void setTag (Object tag)

Set a tag object associated with this ActionMode.

Like the tag available to views, this allows applications to associate arbitrary data with an ActionMode for later reference.

Parameters
`tag` | `Object`: Tag to associate with this ActionMode

See also:

- `getTag()`

### setTitle

    public abstract void setTitle (CharSequence title)

Set the title of the action mode. This method will have no visible effect if a custom view has been set.

Parameters
`title` | `CharSequence`: Title string to set

See also:

- `setTitle(int)`
- `setCustomView(View)`

### setTitle

    public abstract void setTitle (int resId)

Set the title of the action mode. This method will have no visible effect if a custom view has been set.

Parameters
`resId` | `int`: Resource ID of a string to set as the title

See also:

- `setTitle(CharSequence)`
- `setCustomView(View)`

### setTitleOptionalHint

    public void setTitleOptionalHint (boolean titleOptional)

Set whether or not the title/subtitle display for this action mode is optional.

In many cases the supplied title for an action mode is merely meant to add context and is not strictly required for the action mode to be useful. If the title is optional, the system may choose to hide the title entirely rather than truncate it due to a lack of available space.

Note that this is merely a hint; the underlying implementation may choose to ignore this setting under some circumstances.

Parameters
`titleOptional` | `boolean`: true if the title only presents optional information.

### setType

    public void setType (int type)

Set a type for this action mode. This will affect how the system renders the action mode if it has to.

Parameters
`type` | `int`: One of `TYPE_PRIMARY` or `TYPE_FLOATING`.

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*