Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Methods](https://developer.android.com/reference/android/view/Window.Callback#pubmethods)

# Window.Callback

*** ** * ** ***

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


`
public
static


interface
Window.Callback
`


`


`

|---|
| android.view.Window.Callback |

|---|
| Known indirect subclasses [AccountAuthenticatorActivity](https://developer.android.com/reference/android/accounts/AccountAuthenticatorActivity), [Activity](https://developer.android.com/reference/android/app/Activity), [ActivityGroup](https://developer.android.com/reference/android/app/ActivityGroup), [AlertDialog](https://developer.android.com/reference/android/app/AlertDialog), [AliasActivity](https://developer.android.com/reference/android/app/AliasActivity), [CharacterPickerDialog](https://developer.android.com/reference/android/text/method/CharacterPickerDialog), [DatePickerDialog](https://developer.android.com/reference/android/app/DatePickerDialog), [Dialog](https://developer.android.com/reference/android/app/Dialog), [DreamService](https://developer.android.com/reference/android/service/dreams/DreamService), [ExpandableListActivity](https://developer.android.com/reference/android/app/ExpandableListActivity), [LauncherActivity](https://developer.android.com/reference/android/app/LauncherActivity), [ListActivity](https://developer.android.com/reference/android/app/ListActivity), [NativeActivity](https://developer.android.com/reference/android/app/NativeActivity), [PreferenceActivity](https://developer.android.com/reference/android/preference/PreferenceActivity), [Presentation](https://developer.android.com/reference/android/app/Presentation), [ProgressDialog](https://developer.android.com/reference/android/app/ProgressDialog), [TabActivity](https://developer.android.com/reference/android/app/TabActivity), [TimePickerDialog](https://developer.android.com/reference/android/app/TimePickerDialog) |---|---| | [AccountAuthenticatorActivity](https://developer.android.com/reference/android/accounts/AccountAuthenticatorActivity) | *This class was deprecated in API level 30. Applications should extend Activity themselves. This class is not compatible with AppCompat, and the functionality it provides is not complex.* | | [Activity](https://developer.android.com/reference/android/app/Activity) | An activity is a single, focused thing that the user can do. | | [ActivityGroup](https://developer.android.com/reference/android/app/ActivityGroup) | *This class was deprecated in API level 13. Use the new `https://developer.android.com/reference/android/app/Fragment` and `https://developer.android.com/reference/android/app/FragmentManager` APIs instead; these are also available on older platforms through the Android compatibility package.* | | [AlertDialog](https://developer.android.com/reference/android/app/AlertDialog) | A subclass of Dialog that can display one, two or three buttons. | | [AliasActivity](https://developer.android.com/reference/android/app/AliasActivity) | *This class was deprecated in API level 30. Use `<activity-alias>` or subclass Activity directly.* | | [CharacterPickerDialog](https://developer.android.com/reference/android/text/method/CharacterPickerDialog) | Dialog for choosing accented characters related to a base character. | | [DatePickerDialog](https://developer.android.com/reference/android/app/DatePickerDialog) | A simple dialog containing an `https://developer.android.com/reference/android/widget/DatePicker`. | | [Dialog](https://developer.android.com/reference/android/app/Dialog) | Base class for Dialogs. | | [DreamService](https://developer.android.com/reference/android/service/dreams/DreamService) | Extend this class to implement a custom dream (available to the user as a "Daydream"). | | [ExpandableListActivity](https://developer.android.com/reference/android/app/ExpandableListActivity) | *This class was deprecated in API level 30. Use `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.html` or use `https://developer.android.com/reference/android/widget/ExpandableListView` directly* | | [LauncherActivity](https://developer.android.com/reference/android/app/LauncherActivity) | *This class was deprecated in API level 30. Applications can implement this UI themselves using `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.html` and `https://developer.android.com/reference/android/content/pm/PackageManager#queryIntentActivities(android.content.Intent,%20int)`* | | [ListActivity](https://developer.android.com/reference/android/app/ListActivity) | *This class was deprecated in API level 30. Use `https://developer.android.com/reference/androidx/fragment/app/ListFragment.html` or `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.html` to implement your Activity instead.* | | [NativeActivity](https://developer.android.com/reference/android/app/NativeActivity) | Convenience for implementing an activity that will be implemented purely in native code. | | [PreferenceActivity](https://developer.android.com/reference/android/preference/PreferenceActivity) | *This class was deprecated in API level 29. Use the [AndroidX](https://developer.android.com/jetpack/androidx) [Preference Library](https://developer.android.com/reference/androidx/preference/package-summary) for consistent behavior across all devices. For more information on using the AndroidX Preference Library see [Settings](https://developer.android.com/guide/topics/ui/settings).* | | [Presentation](https://developer.android.com/reference/android/app/Presentation) | Base class for presentations. | | [ProgressDialog](https://developer.android.com/reference/android/app/ProgressDialog) | *This class was deprecated in API level 26. `ProgressDialog` is a modal dialog, which prevents the user from interacting with the app. Instead of using this class, you should use a progress indicator like `https://developer.android.com/reference/android/widget/ProgressBar`, which can be embedded in your app's UI. Alternatively, you can use a [notification](https://developer.android.com/guide/topics/ui/notifiers/notifications) to inform the user of the task's progress.* | | [TabActivity](https://developer.android.com/reference/android/app/TabActivity) | *This class was deprecated in API level 13. New applications should use Fragments instead of this class; to continue to run on older devices, you can use the v4 support library which provides a version of the Fragment API that is compatible down to `https://developer.android.com/reference/android/os/Build.VERSION_CODES#DONUT`.* | | [TimePickerDialog](https://developer.android.com/reference/android/app/TimePickerDialog) | A dialog that prompts the user for the time of day using a `https://developer.android.com/reference/android/widget/TimePicker`. | |

<br />

*** ** * ** ***

API from a Window back to its caller. This allows the client to
intercept key dispatching, panels and menus, etc.

## Summary

| ### Public methods ||
|---|---|
| ` abstract boolean` | ` https://developer.android.com/reference/android/view/Window.Callback#dispatchGenericMotionEvent(android.view.MotionEvent)(https://developer.android.com/reference/android/view/MotionEvent event) ` Called to process generic motion events. |
| ` abstract boolean` | ` https://developer.android.com/reference/android/view/Window.Callback#dispatchKeyEvent(android.view.KeyEvent)(https://developer.android.com/reference/android/view/KeyEvent event) ` Called to process key events. |
| ` abstract boolean` | ` https://developer.android.com/reference/android/view/Window.Callback#dispatchKeyShortcutEvent(android.view.KeyEvent)(https://developer.android.com/reference/android/view/KeyEvent event) ` Called to process a key shortcut event. |
| ` abstract boolean` | ` https://developer.android.com/reference/android/view/Window.Callback#dispatchPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent)(https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent event) ` Called to process population of `https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent`s. |
| ` abstract boolean` | ` https://developer.android.com/reference/android/view/Window.Callback#dispatchTouchEvent(android.view.MotionEvent)(https://developer.android.com/reference/android/view/MotionEvent event) ` Called to process touch screen events. |
| ` abstract boolean` | ` https://developer.android.com/reference/android/view/Window.Callback#dispatchTrackballEvent(android.view.MotionEvent)(https://developer.android.com/reference/android/view/MotionEvent event) ` Called to process trackball events. |
| ` abstract void` | ` https://developer.android.com/reference/android/view/Window.Callback#onActionModeFinished(android.view.ActionMode)(https://developer.android.com/reference/android/view/ActionMode mode) ` Called when an action mode has been finished. |
| ` abstract void` | ` https://developer.android.com/reference/android/view/Window.Callback#onActionModeStarted(android.view.ActionMode)(https://developer.android.com/reference/android/view/ActionMode mode) ` Called when an action mode has been started. |
| ` abstract void` | ` https://developer.android.com/reference/android/view/Window.Callback#onAttachedToWindow()() ` Called when the window has been attached to the window manager. |
| ` abstract void` | ` https://developer.android.com/reference/android/view/Window.Callback#onContentChanged()() ` This hook is called whenever the content view of the screen changes (due to a call to `https://developer.android.com/reference/android/view/Window#setContentView(android.view.View,%20android.view.ViewGroup.LayoutParams)` or `https://developer.android.com/reference/android/view/Window#addContentView(android.view.View,%20android.view.ViewGroup.LayoutParams)`). |
| ` abstract boolean` | ` https://developer.android.com/reference/android/view/Window.Callback#onCreatePanelMenu(int,%20android.view.Menu)(int featureId, https://developer.android.com/reference/android/view/Menu menu) ` Initialize the contents of the menu for panel 'featureId'. |
| ` abstract https://developer.android.com/reference/android/view/View` | ` https://developer.android.com/reference/android/view/Window.Callback#onCreatePanelView(int)(int featureId) ` Instantiate the view to display in the panel for 'featureId'. |
| ` abstract void` | ` https://developer.android.com/reference/android/view/Window.Callback#onDetachedFromWindow()() ` Called when the window has been detached from the window manager. |
| ` abstract boolean` | ` https://developer.android.com/reference/android/view/Window.Callback#onMenuItemSelected(int,%20android.view.MenuItem)(int featureId, https://developer.android.com/reference/android/view/MenuItem item) ` Called when a panel's menu item has been selected by the user. |
| ` abstract boolean` | ` https://developer.android.com/reference/android/view/Window.Callback#onMenuOpened(int,%20android.view.Menu)(int featureId, https://developer.android.com/reference/android/view/Menu menu) ` Called when a panel's menu is opened by the user. |
| ` abstract void` | ` https://developer.android.com/reference/android/view/Window.Callback#onPanelClosed(int,%20android.view.Menu)(int featureId, https://developer.android.com/reference/android/view/Menu menu) ` Called when a panel is being closed. |
| ` default void` | ` https://developer.android.com/reference/android/view/Window.Callback#onPointerCaptureChanged(boolean)(boolean hasCapture) ` Called when pointer capture is enabled or disabled for the current window. |
| ` abstract boolean` | ` https://developer.android.com/reference/android/view/Window.Callback#onPreparePanel(int,%20android.view.View,%20android.view.Menu)(int featureId, https://developer.android.com/reference/android/view/View view, https://developer.android.com/reference/android/view/Menu menu) ` Prepare a panel to be displayed. |
| ` default void` | ` https://developer.android.com/reference/android/view/Window.Callback#onProvideKeyboardShortcuts(java.util.List<android.view.KeyboardShortcutGroup>,%20android.view.Menu,%20int)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/view/KeyboardShortcutGroup> data, https://developer.android.com/reference/android/view/Menu menu, int deviceId) ` Called when Keyboard Shortcuts are requested for the current window. |
| ` abstract boolean` | ` https://developer.android.com/reference/android/view/Window.Callback#onSearchRequested()() ` Called when the user signals the desire to start a search. |
| ` abstract boolean` | ` https://developer.android.com/reference/android/view/Window.Callback#onSearchRequested(android.view.SearchEvent)(https://developer.android.com/reference/android/view/SearchEvent searchEvent) ` Called when the user signals the desire to start a search. |
| ` abstract void` | ` https://developer.android.com/reference/android/view/Window.Callback#onWindowAttributesChanged(android.view.WindowManager.LayoutParams)(https://developer.android.com/reference/android/view/WindowManager.LayoutParams attrs) ` This is called whenever the current window attributes change. |
| ` abstract void` | ` https://developer.android.com/reference/android/view/Window.Callback#onWindowFocusChanged(boolean)(boolean hasFocus) ` This hook is called whenever the window focus changes. |
| ` abstract https://developer.android.com/reference/android/view/ActionMode` | ` https://developer.android.com/reference/android/view/Window.Callback#onWindowStartingActionMode(android.view.ActionMode.Callback)(https://developer.android.com/reference/android/view/ActionMode.Callback callback) ` Called when an action mode is being started for this window. |
| ` abstract https://developer.android.com/reference/android/view/ActionMode` | ` https://developer.android.com/reference/android/view/Window.Callback#onWindowStartingActionMode(android.view.ActionMode.Callback,%20int)(https://developer.android.com/reference/android/view/ActionMode.Callback callback, int type) ` Called when an action mode is being started for this window. |

## Public methods

### dispatchGenericMotionEvent

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

```
public abstract boolean dispatchGenericMotionEvent (MotionEvent event)
```

Called to process generic motion events. At the very least your
implementation must call
`https://developer.android.com/reference/android/view/Window#superDispatchGenericMotionEvent(android.view.MotionEvent)` to do the
standard processing.

<br />

| Parameters ||
|---|---|
| `event` | `MotionEvent`: The generic motion event. <br /> |

| Returns ||
|---|---|
| `boolean` | boolean Return true if this event was consumed. <br /> |

### dispatchKeyEvent

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

```
public abstract boolean dispatchKeyEvent (KeyEvent event)
```

Called to process key events. At the very least your
implementation must call
`https://developer.android.com/reference/android/view/Window#superDispatchKeyEvent(android.view.KeyEvent)` to do the
standard key processing.

<br />

| Parameters ||
|---|---|
| `event` | `KeyEvent`: The key event. <br /> |

| Returns ||
|---|---|
| `boolean` | boolean Return true if this event was consumed. <br /> |

### dispatchKeyShortcutEvent

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

```
public abstract boolean dispatchKeyShortcutEvent (KeyEvent event)
```

Called to process a key shortcut event.
At the very least your implementation must call
`https://developer.android.com/reference/android/view/Window#superDispatchKeyShortcutEvent(android.view.KeyEvent)` to do the
standard key shortcut processing.

<br />

| Parameters ||
|---|---|
| `event` | `KeyEvent`: The key shortcut event. <br /> |

| Returns ||
|---|---|
| `boolean` | True if this event was consumed. <br /> |

### dispatchPopulateAccessibilityEvent

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

```
public abstract boolean dispatchPopulateAccessibilityEvent (AccessibilityEvent event)
```

Called to process population of `https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent`s.

<br />

| Parameters ||
|---|---|
| `event` | `AccessibilityEvent`: The event. <br /> |

| Returns ||
|---|---|
| `boolean` | boolean Return true if event population was completed. <br /> |

### dispatchTouchEvent

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

```
public abstract boolean dispatchTouchEvent (MotionEvent event)
```

Called to process touch screen events. At the very least your
implementation must call
`https://developer.android.com/reference/android/view/Window#superDispatchTouchEvent(android.view.MotionEvent)` to do the
standard touch screen processing.

<br />

| Parameters ||
|---|---|
| `event` | `MotionEvent`: The touch screen event. <br /> |

| Returns ||
|---|---|
| `boolean` | boolean Return true if this event was consumed. <br /> |

### dispatchTrackballEvent

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

```
public abstract boolean dispatchTrackballEvent (MotionEvent event)
```

Called to process trackball events. At the very least your
implementation must call
`https://developer.android.com/reference/android/view/Window#superDispatchTrackballEvent(android.view.MotionEvent)` to do the
standard trackball processing.

<br />

| Parameters ||
|---|---|
| `event` | `MotionEvent`: The trackball event. <br /> |

| Returns ||
|---|---|
| `boolean` | boolean Return true if this event was consumed. <br /> |

### onActionModeFinished

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

```
public abstract void onActionModeFinished (ActionMode mode)
```

Called when an action mode has been finished. The appropriate mode callback
method will have already been invoked.

<br />

| Parameters ||
|---|---|
| `mode` | `ActionMode`: The mode that was just finished. <br /> |

### onActionModeStarted

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

```
public abstract void onActionModeStarted (ActionMode mode)
```

Called when an action mode has been started. The appropriate mode callback
method will have already been invoked.

<br />

| Parameters ||
|---|---|
| `mode` | `ActionMode`: The new mode that has just been started. <br /> |

### onAttachedToWindow

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

```
public abstract void onAttachedToWindow ()
```

Called when the window has been attached to the window manager.
See `https://developer.android.com/reference/android/view/View#onAttachedToWindow()`
for more information.

<br />

### onContentChanged

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

```
public abstract void onContentChanged ()
```

This hook is called whenever the content view of the screen changes
(due to a call to
`https://developer.android.com/reference/android/view/Window#setContentView(android.view.View,%20android.view.ViewGroup.LayoutParams)` or
`https://developer.android.com/reference/android/view/Window#addContentView(android.view.View,%20android.view.ViewGroup.LayoutParams)`).

<br />

### onCreatePanelMenu

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

```
public abstract boolean onCreatePanelMenu (int featureId, 
                Menu menu)
```

Initialize the contents of the menu for panel 'featureId'. This is
called if onCreatePanelView() returns null, giving you a standard
menu in which you can place your items. It is only called once for
the panel, the first time it is shown.

You can safely hold on to <var translate="no">menu</var> (and any items created
from it), making modifications to it as desired, until the next
time onCreatePanelMenu() is called for this feature.

<br />

| Parameters ||
|---|---|
| `featureId` | `int`: The panel being created. <br /> |
| `menu` | `Menu`: The menu inside the panel. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | boolean You must return true for the panel to be displayed; if you return false it will not be shown. <br /> |

### onCreatePanelView

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

```
public abstract View onCreatePanelView (int featureId)
```

Instantiate the view to display in the panel for 'featureId'.
You can return null, in which case the default content (typically
a menu) will be created for you.

<br />

| Parameters ||
|---|---|
| `featureId` | `int`: Which panel is being created. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/View` | view The top-level view to place in the panel. <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/Window.Callback#onPreparePanel(int,%20android.view.View,%20android.view.Menu)`

### onDetachedFromWindow

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

```
public abstract void onDetachedFromWindow ()
```

Called when the window has been detached from the window manager.
See `https://developer.android.com/reference/android/view/View#onDetachedFromWindow()`
for more information.

<br />

### onMenuItemSelected

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

```
public abstract boolean onMenuItemSelected (int featureId, 
                MenuItem item)
```

Called when a panel's menu item has been selected by the user.

<br />

| Parameters ||
|---|---|
| `featureId` | `int`: The panel that the menu is in. <br /> |
| `item` | `MenuItem`: The menu item that was selected. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | boolean Return true to finish processing of selection, or false to perform the normal menu handling (calling its Runnable or sending a Message to its target Handler). <br /> |

### onMenuOpened

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

```
public abstract boolean onMenuOpened (int featureId, 
                Menu menu)
```

Called when a panel's menu is opened by the user. This may also be
called when the menu is changing from one type to another (for
example, from the icon menu to the expanded menu).

<br />

| Parameters ||
|---|---|
| `featureId` | `int`: The panel that the menu is in. <br /> |
| `menu` | `Menu`: The menu that is opened. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | Return true to allow the menu to open, or false to prevent the menu from opening. <br /> |

### onPanelClosed

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

```
public abstract void onPanelClosed (int featureId, 
                Menu menu)
```

Called when a panel is being closed. If another logical subsequent
panel is being opened (and this panel is being closed to make room for the subsequent
panel), this method will NOT be called.

<br />

| Parameters ||
|---|---|
| `featureId` | `int`: The panel that is being displayed. <br /> |
| `menu` | `Menu`: If onCreatePanelView() returned null, this is the Menu being displayed in the panel. <br /> |

### onPointerCaptureChanged

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

```
public void onPointerCaptureChanged (boolean hasCapture)
```

Called when pointer capture is enabled or disabled for the current window.

<br />

| Parameters ||
|---|---|
| `hasCapture` | `boolean`: True if the window has pointer capture. <br /> |

### onPreparePanel

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

```
public abstract boolean onPreparePanel (int featureId, 
                View view, 
                Menu menu)
```

Prepare a panel to be displayed. This is called right before the
panel window is shown, every time it is shown.

<br />

| Parameters ||
|---|---|
| `featureId` | `int`: The panel that is being displayed. <br /> |
| `view` | `View`: The View that was returned by onCreatePanelView(). This value may be `null`. <br /> |
| `menu` | `Menu`: If onCreatePanelView() returned null, this is the Menu being displayed in the panel. <br /> |

| Returns ||
|---|---|
| `boolean` | boolean You must return true for the panel to be displayed; if you return false it will not be shown. <br /> |

**See also:**

- `https://developer.android.com/reference/android/view/Window.Callback#onCreatePanelView(int)`

### onProvideKeyboardShortcuts

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

```
public void onProvideKeyboardShortcuts (List<KeyboardShortcutGroup> data, 
                Menu menu, 
                int deviceId)
```

Called when Keyboard Shortcuts are requested for the current window.

<br />

| Parameters ||
|---|---|
| `data` | `List`: The data list to populate with shortcuts. <br /> |
| `menu` | `Menu`: The current menu, which may be null. <br /> |
| `deviceId` | `int`: The id for the connected device the shortcuts should be provided for. <br /> |

### onSearchRequested

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

```
public abstract boolean onSearchRequested ()
```

Called when the user signals the desire to start a search.

<br />

| Returns ||
|---|---|
| `boolean` | true if search launched, false if activity refuses (blocks) <br /> |

**See also:**

- `https://developer.android.com/reference/android/app/Activity#onSearchRequested()`

### onSearchRequested

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

```
public abstract boolean onSearchRequested (SearchEvent searchEvent)
```

Called when the user signals the desire to start a search.

<br />

| Parameters ||
|---|---|
| `searchEvent` | `SearchEvent`: A `https://developer.android.com/reference/android/view/SearchEvent` describing the signal to start a search. <br /> |

| Returns ||
|---|---|
| `boolean` | true if search launched, false if activity refuses (blocks) <br /> |

### onWindowAttributesChanged

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

```
public abstract void onWindowAttributesChanged (WindowManager.LayoutParams attrs)
```

This is called whenever the current window attributes change.

<br />

| Parameters ||
|---|---|
| `attrs` | `WindowManager.LayoutParams` <br /> |

### onWindowFocusChanged

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

```
public abstract void onWindowFocusChanged (boolean hasFocus)
```

This hook is called whenever the window focus changes. See
`https://developer.android.com/reference/android/view/View#onWindowFocusChanged(boolean)` for more information.

<br />

| Parameters ||
|---|---|
| `hasFocus` | `boolean`: Whether the window now has focus. <br /> |

### onWindowStartingActionMode

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

```
public abstract ActionMode onWindowStartingActionMode (ActionMode.Callback callback)
```

Called when an action mode is being started for this window. Gives the
callback an opportunity to handle the action mode in its own unique and
beautiful way. If this method returns null the system can choose a way
to present the mode or choose not to start the mode at all. This is equivalent
to `https://developer.android.com/reference/android/view/Window.Callback#onWindowStartingActionMode(android.view.ActionMode.Callback,%20int)`
with type `https://developer.android.com/reference/android/view/ActionMode#TYPE_PRIMARY`.

<br />

| Parameters ||
|---|---|
| `callback` | `ActionMode.Callback`: Callback to control the lifecycle of this action mode <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/ActionMode` | The ActionMode that was started, or null if the system should present it <br /> |

### onWindowStartingActionMode

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

```
public abstract ActionMode onWindowStartingActionMode (ActionMode.Callback callback, 
                int type)
```

Called when an action mode is being started for this window. Gives the
callback an opportunity to handle the action mode in its own unique and
beautiful way. If this method returns null the system can choose a way
to present the mode or choose not to start the mode at all.

<br />

| Parameters ||
|---|---|
| `callback` | `ActionMode.Callback`: Callback to control the lifecycle of this action mode <br /> |
| `type` | `int`: One of `https://developer.android.com/reference/android/view/ActionMode#TYPE_PRIMARY` or `https://developer.android.com/reference/android/view/ActionMode#TYPE_FLOATING`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/ActionMode` | The ActionMode that was started, or null if the system should present it <br /> |