Stay organized with collections
Save and categorize content based on your preferences.
View.OnAttachStateChangeListener
public
static
interface
View.OnAttachStateChangeListener
android.view.View.OnAttachStateChangeListener
|
Interface definition for a callback to be invoked when this view is attached
or detached from its window.
Summary
Public methods
onViewAttachedToWindow
public abstract void onViewAttachedToWindow (View v)
Called when the view is attached to a window.
Parameters |
v |
View : The view that was attached
This value cannot be null . |
onViewDetachedFromWindow
public abstract void onViewDetachedFromWindow (View v)
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.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# View.OnAttachStateChangeListener\n\nAdded in [API level 12](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\nView.OnAttachStateChangeListener\n================================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/view/View.OnAttachStateChangeListener \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\nstatic\n\n\ninterface\nView.OnAttachStateChangeListener\n`\n\n\n`\n\n\n`\n\n|-----------------------------------------------|\n| android.view.View.OnAttachStateChangeListener |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nInterface definition for a callback to be invoked when this view is attached\nor detached from its window.\n\nSummary\n-------\n\n| ### Public methods ||\n|------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract void` | ` `[onViewAttachedToWindow](/reference/android/view/View.OnAttachStateChangeListener#onViewAttachedToWindow(android.view.View))`(`[View](/reference/android/view/View)` v) ` Called when the view is attached to a window. |\n| ` abstract void` | ` `[onViewDetachedFromWindow](/reference/android/view/View.OnAttachStateChangeListener#onViewDetachedFromWindow(android.view.View))`(`[View](/reference/android/view/View)` v) ` Called when the view is detached from a window. |\n\nPublic methods\n--------------\n\n### onViewAttachedToWindow\n\nAdded in [API level 12](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void onViewAttachedToWindow (View v)\n```\n\nCalled when the view is attached to a window.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-----|------------------------------------------------------------------------|\n| `v` | `View`: The view that was attached This value cannot be `null`. \u003cbr /\u003e |\n\n### onViewDetachedFromWindow\n\nAdded in [API level 12](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void onViewDetachedFromWindow (View v)\n```\n\nCalled when the view is detached from a window.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-----|------------------------------------------------------------------------|\n| `v` | `View`: The view that was detached This value cannot be `null`. \u003cbr /\u003e |"]]