Stay organized with collections
Save and categorize content based on your preferences.
OnAttachStateChangeListener
interface OnAttachStateChangeListener
Interface definition for a callback to be invoked when this view is attached or detached from its window.
Summary
Public methods |
abstract Unit |
Called when the view is attached to a window.
|
abstract Unit |
Called when the view is detached from a window.
|
Public methods
onViewAttachedToWindow
abstract fun onViewAttachedToWindow(v: View): Unit
Called when the view is attached to a window.
Parameters |
v |
View: The view that was attached This value cannot be null . |
onViewDetachedFromWindow
abstract fun onViewDetachedFromWindow(v: View): Unit
Called when the view is detached from a window.
Parameters |
v |
View: The view that was detached This value cannot be null . |
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-02-10 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-02-10 UTC."],[],[],null,["# View.OnAttachStateChangeListener\n\nAdded in [API level 12](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nOnAttachStateChangeListener\n===========================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/view/View.OnAttachStateChangeListener \"View this page in Java\") \n\n```\ninterface OnAttachStateChangeListener\n```\n\n|----------------------------------------------------|\n| [android.view.View.OnAttachStateChangeListener](#) |\n\nInterface definition for a callback to be invoked when this view is attached or detached from its window.\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onViewAttachedToWindow](#onViewAttachedToWindow(android.view.View))`(`v:` `[View](/reference/kotlin/android/view/View)`)` Called when the view is attached to a window. |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onViewDetachedFromWindow](#onViewDetachedFromWindow(android.view.View))`(`v:` `[View](/reference/kotlin/android/view/View)`)` Called when the view is detached from a window. |\n\nPublic methods\n--------------\n\n### onViewAttachedToWindow\n\nAdded in [API level 12](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onViewAttachedToWindow(v: View): Unit\n```\n\nCalled when the view is attached to a window.\n\n| Parameters ||\n|-----|------------------------------------------------------------------------------------------------------|\n| `v` | [View](/reference/kotlin/android/view/View): The view that was attached This value cannot be `null`. |\n\n### onViewDetachedFromWindow\n\nAdded in [API level 12](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onViewDetachedFromWindow(v: View): Unit\n```\n\nCalled when the view is detached from a window.\n\n| Parameters ||\n|-----|------------------------------------------------------------------------------------------------------|\n| `v` | [View](/reference/kotlin/android/view/View): The view that was detached This value cannot be `null`. |"]]