Stay organized with collections
Save and categorize content based on your preferences.
DisplayListener
interface DisplayListener
Listens for changes in available display devices.
Summary
Public methods |
abstract Unit |
Called whenever a logical display has been added to the system.
|
abstract Unit |
Called whenever the properties of a logical android.view.Display , such as size and density, have changed.
|
abstract Unit |
Called whenever a logical display has been removed from the system.
|
Public methods
onDisplayAdded
abstract fun onDisplayAdded(displayId: Int): Unit
Called whenever a logical display has been added to the system. Use DisplayManager.getDisplay
to get more information about the display.
Parameters |
displayId |
Int: The id of the logical display that was added. |
onDisplayChanged
abstract fun onDisplayChanged(displayId: Int): Unit
Called whenever the properties of a logical android.view.Display
, such as size and density, have changed.
Parameters |
displayId |
Int: The id of the logical display that changed. |
onDisplayRemoved
abstract fun onDisplayRemoved(displayId: Int): Unit
Called whenever a logical display has been removed from the system.
Parameters |
displayId |
Int: The id of the logical display that was removed. |
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,["# DisplayManager.DisplayListener\n\nAdded in [API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nDisplayListener\n===============\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/hardware/display/DisplayManager.DisplayListener \"View this page in Java\") \n\n```\ninterface DisplayListener\n```\n\n|--------------------------------------------------------------|\n| [android.hardware.display.DisplayManager.DisplayListener](#) |\n\nListens for changes in available display devices.\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onDisplayAdded](#onDisplayAdded(kotlin.Int))`(`displayId:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Called whenever a logical display has been added to the system. |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onDisplayChanged](#onDisplayChanged(kotlin.Int))`(`displayId:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Called whenever the properties of a logical [android.view.Display](../../view/Display.html#), such as size and density, have changed. |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onDisplayRemoved](#onDisplayRemoved(kotlin.Int))`(`displayId:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Called whenever a logical display has been removed from the system. |\n\nPublic methods\n--------------\n\n### onDisplayAdded\n\nAdded in [API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onDisplayAdded(displayId: Int): Unit\n```\n\nCalled whenever a logical display has been added to the system. Use [DisplayManager.getDisplay](/reference/kotlin/android/hardware/display/DisplayManager#getDisplay(kotlin.Int)) to get more information about the display.\n\n| Parameters ||\n|-------------|---------------------------------------------------------------------------------------------------------------------------|\n| `displayId` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The id of the logical display that was added. |\n\n### onDisplayChanged\n\nAdded in [API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onDisplayChanged(displayId: Int): Unit\n```\n\nCalled whenever the properties of a logical [android.view.Display](../../view/Display.html#), such as size and density, have changed.\n\n| Parameters ||\n|-------------|-------------------------------------------------------------------------------------------------------------------------|\n| `displayId` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The id of the logical display that changed. |\n\n### onDisplayRemoved\n\nAdded in [API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onDisplayRemoved(displayId: Int): Unit\n```\n\nCalled whenever a logical display has been removed from the system.\n\n| Parameters ||\n|-------------|-----------------------------------------------------------------------------------------------------------------------------|\n| `displayId` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The id of the logical display that was removed. |"]]