Stay organized with collections
Save and categorize content based on your preferences.
WindowInspector
class WindowInspector
Provides access to window inspection information.
Summary
Public methods |
static Unit |
Adds a listener that is notified whenever the value of getGlobalWindowViews() changes.
|
static MutableList<View!> |
|
static Unit |
Removes a listener from getting notifications of global window views changes.
|
Public methods
addGlobalWindowViewsListener
static fun addGlobalWindowViewsListener(
executor: Executor,
consumer: Consumer<MutableList<View!>!>
): Unit
Adds a listener that is notified whenever the value of getGlobalWindowViews()
changes. The current value is provided immediately using the provided Executor
. The value is initially relayed using the main thread and then posted to the Executor
. Using a direct Executor
and doing heavy calculations can cause performance issues. If this Consumer
is already registered, then this method is a no op.
getGlobalWindowViews
static fun getGlobalWindowViews(): MutableList<View!>
Return |
MutableList<View!> |
the list of all window views attached to the current process This value cannot be null . |
removeGlobalWindowViewsListener
static fun removeGlobalWindowViewsListener(consumer: Consumer<MutableList<View!>!>): Unit
Removes a listener from getting notifications of global window views changes. If the Consumer
is not registered this method is a no op.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-08-20 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-20 UTC."],[],[],null,["# WindowInspector\n\nAdded in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nWindowInspector\n===============\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/view/inspector/WindowInspector \"View this page in Java\") \n\n```\nclass WindowInspector\n```\n\n|---|---------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.view.inspector.WindowInspector](#) |\n\nProvides access to window inspection information.\n\nSummary\n-------\n\n| Public methods ||\n|------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| static [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [addGlobalWindowViewsListener](#addGlobalWindowViewsListener(java.util.concurrent.Executor,%20java.util.function.Consumer))`(`executor:` `[Executor](../../../java/util/concurrent/Executor.html#)`, `consumer:` `[Consumer](../../../java/util/function/Consumer.html#)\u003c[MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\u003c[View](../View.html#)!\u003e!\u003e`)` Adds a listener that is notified whenever the value of [getGlobalWindowViews()](#getGlobalWindowViews()) changes. |\n| static [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\\\u003c[View](../View.html#)!\\\u003e | [getGlobalWindowViews](#getGlobalWindowViews())`()` \u003cbr /\u003e |\n| static [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [removeGlobalWindowViewsListener](#removeGlobalWindowViewsListener(java.util.function.Consumer))`(`consumer:` `[Consumer](../../../java/util/function/Consumer.html#)\u003c[MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\u003c[View](../View.html#)!\u003e!\u003e`)` Removes a listener from getting notifications of global window views changes. |\n\nPublic methods\n--------------\n\n### addGlobalWindowViewsListener\n\nAdded in [API level Baklava](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic fun addGlobalWindowViewsListener(\n executor: Executor, \n consumer: Consumer\u003cMutableList\u003cView!\u003e!\u003e\n): Unit\n```\n\nAdds a listener that is notified whenever the value of [getGlobalWindowViews()](#getGlobalWindowViews()) changes. The current value is provided immediately using the provided [Executor](../../../java/util/concurrent/Executor.html#). The value is initially relayed using the main thread and then posted to the [Executor](../../../java/util/concurrent/Executor.html#). Using a direct [Executor](../../../java/util/concurrent/Executor.html#) and doing heavy calculations can cause performance issues. If this [Consumer](../../../java/util/function/Consumer.html#) is already registered, then this method is a no op.\n\n| Parameters ||\n|------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `executor` | [Executor](../../../java/util/concurrent/Executor.html#): This value cannot be `null`. |\n| `consumer` | [Consumer](../../../java/util/function/Consumer.html#)\\\u003c[MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\\\u003c[View](../View.html#)!\\\u003e!\\\u003e: This value cannot be `null`. |\n\n**See Also**\n\n- \u003c#getGlobalWindowViews()\u003e \n\n### getGlobalWindowViews\n\nAdded in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic fun getGlobalWindowViews(): MutableList\u003cView!\u003e\n```\n\n| Return ||\n|---------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------|\n| [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\u003c[View](../View.html#)!\u003e | the list of all window views attached to the current process This value cannot be `null`. |\n\n### removeGlobalWindowViewsListener\n\nAdded in [API level Baklava](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic fun removeGlobalWindowViewsListener(consumer: Consumer\u003cMutableList\u003cView!\u003e!\u003e): Unit\n```\n\nRemoves a listener from getting notifications of global window views changes. If the [Consumer](../../../java/util/function/Consumer.html#) is not registered this method is a no op.\n\n| Parameters ||\n|------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `consumer` | [Consumer](../../../java/util/function/Consumer.html#)\\\u003c[MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\\\u003c[View](../View.html#)!\\\u003e!\\\u003e: This value cannot be `null`. |\n\n**See Also**\n\n- [#addGlobalWindowViewsListener(Executor, Consumer)](#addGlobalWindowViewsListener(java.util.concurrent.Executor,%20java.util.function.Consumer))"]]