# ActionMode.Callback2

Added in[API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Ctors](https://developer.android.com/reference/android/view/ActionMode.Callback2#pubctors)\|[Methods](https://developer.android.com/reference/android/view/ActionMode.Callback2#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/view/ActionMode.Callback2#inhmethods)  

# ActionMode.Callback2

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/view/ActionMode.Callback2 "View this page in Kotlin")\|Java

`
public
static

abstract
class
ActionMode.Callback2
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


implements

`[ActionMode.Callback](https://developer.android.com/reference/android/view/ActionMode.Callback)`


`

|---|-----------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.view.ActionMode.Callback2 |

<br />

*** ** * ** ***

Extension of[ActionMode.Callback](https://developer.android.com/reference/android/view/ActionMode.Callback)to provide content rect information. This is required for ActionModes with dynamic positioning such as the ones with type[ActionMode.TYPE_FLOATING](https://developer.android.com/reference/android/view/ActionMode#TYPE_FLOATING)to ensure the positioning doesn't obscure app content. If an app fails to provide a subclass of this class, a default implementation will be used.

## Summary

|                                            ### Public constructors                                            ||
|------------------------------------------------------------------------------------------------------------|---|
| ` `[Callback2](https://developer.android.com/reference/android/view/ActionMode.Callback2#Callback2())`() ` |

|                                                                                                                                                                                                                                                                  ### Public methods                                                                                                                                                                                                                                                                   ||
|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` void` | ` `[onGetContentRect](https://developer.android.com/reference/android/view/ActionMode.Callback2#onGetContentRect(android.view.ActionMode,%20android.view.View,%20android.graphics.Rect))`(`[ActionMode](https://developer.android.com/reference/android/view/ActionMode)` mode, `[View](https://developer.android.com/reference/android/view/View)` view, `[Rect](https://developer.android.com/reference/android/graphics/Rect)` outRect) ` Called when an ActionMode needs to be positioned on screen, potentially occluding view content. |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||
| From interface` `[android.view.ActionMode.Callback](https://developer.android.com/reference/android/view/ActionMode.Callback)` ` |---------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract boolean` | ` `[onActionItemClicked](https://developer.android.com/reference/android/view/ActionMode.Callback#onActionItemClicked(android.view.ActionMode,%20android.view.MenuItem))`(`[ActionMode](https://developer.android.com/reference/android/view/ActionMode)` mode, `[MenuItem](https://developer.android.com/reference/android/view/MenuItem)` item) ` Called to report a user click on an action button.             | | ` abstract boolean` | ` `[onCreateActionMode](https://developer.android.com/reference/android/view/ActionMode.Callback#onCreateActionMode(android.view.ActionMode,%20android.view.Menu))`(`[ActionMode](https://developer.android.com/reference/android/view/ActionMode)` mode, `[Menu](https://developer.android.com/reference/android/view/Menu)` menu) ` Called when action mode is first created.                                    | | ` abstract void`    | ` `[onDestroyActionMode](https://developer.android.com/reference/android/view/ActionMode.Callback#onDestroyActionMode(android.view.ActionMode))`(`[ActionMode](https://developer.android.com/reference/android/view/ActionMode)` mode) ` Called when an action mode is about to be exited and destroyed.                                                                                                           | | ` abstract boolean` | ` `[onPrepareActionMode](https://developer.android.com/reference/android/view/ActionMode.Callback#onPrepareActionMode(android.view.ActionMode,%20android.view.Menu))`(`[ActionMode](https://developer.android.com/reference/android/view/ActionMode)` mode, `[Menu](https://developer.android.com/reference/android/view/Menu)` menu) ` Called to refresh an action mode's action menu whenever it is invalidated. | ||

## Public constructors

### Callback2

```
public Callback2 ()
```

<br />

<br />

## Public methods

### onGetContentRect

Added in[API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void onGetContentRect (ActionMode mode, 
                View view, 
                Rect outRect)
```

Called when an ActionMode needs to be positioned on screen, potentially occluding view content. Note this may be called on a per-frame basis.

<br />

|                                                                                                                      Parameters                                                                                                                       ||
|-----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `mode`    | `ActionMode`: The ActionMode that requires positioning. <br />                                                                                                                                                                             |
| `view`    | `View`: The View that originated the ActionMode, in whose coordinates the Rect should be provided. <br />                                                                                                                                  |
| `outRect` | `Rect`: The Rect to be populated with the content position. Use this to specify where the content in your app lives within the given view. This will be used to avoid occluding the given content Rect with the created ActionMode. <br /> |