Stay organized with collections
Save and categorize content based on your preferences.
ContrastChangeListener
interface ContrastChangeListener
Listener for the UI contrast. To listen for changes to the UI contrast on the device, implement this interface and register it with the system by calling addContrastChangeListener
.
Summary
Public methods |
abstract Unit |
Called when the color contrast enabled state changes.
|
Public methods
onContrastChanged
abstract fun onContrastChanged(contrast: Float): Unit
Called when the color contrast enabled state changes.
Parameters |
contrast |
Float: The color contrast as in getContrast Value is between -1.0f and 1.0f inclusive |
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,["# UiModeManager.ContrastChangeListener\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nContrastChangeListener\n======================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/app/UiModeManager.ContrastChangeListener \"View this page in Java\") \n\n```\ninterface ContrastChangeListener\n```\n\n|-------------------------------------------------------|\n| [android.app.UiModeManager.ContrastChangeListener](#) |\n\nListener for the UI contrast. To listen for changes to the UI contrast on the device, implement this interface and register it with the system by calling [addContrastChangeListener](/reference/kotlin/android/app/UiModeManager#addContrastChangeListener(java.util.concurrent.Executor,%20android.app.UiModeManager.ContrastChangeListener)).\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onContrastChanged](#onContrastChanged(kotlin.Float))`(`contrast:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`)` Called when the color contrast enabled state changes. |\n\nPublic methods\n--------------\n\n### onContrastChanged\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onContrastChanged(contrast: Float): Unit\n```\n\nCalled when the color contrast enabled state changes.\n\n| Parameters ||\n|------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `contrast` | [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html): The color contrast as in [getContrast](/reference/kotlin/android/app/UiModeManager#getContrast()) Value is between -1.0f and 1.0f inclusive |"]]