Stay organized with collections
Save and categorize content based on your preferences.
interface InputDeviceListener
Listens for changes in input devices.
Summary
Public methods |
abstract Unit |
Called whenever an input device has been added to the system.
|
abstract Unit |
Called whenever the properties of an input device have changed since they were last queried.
|
abstract Unit |
Called whenever an input device has been removed from the system.
|
Public methods
abstract fun onInputDeviceAdded(deviceId: Int): Unit
Called whenever an input device has been added to the system. Use getInputDevice(int)
to get more information about the device.
Parameters |
deviceId |
Int: The id of the input device that was added. |
abstract fun onInputDeviceChanged(deviceId: Int): Unit
Called whenever the properties of an input device have changed since they were last queried. Use InputManager.getInputDevice
to get a fresh InputDevice
object with the new properties.
Parameters |
deviceId |
Int: The id of the input device that changed. |
abstract fun onInputDeviceRemoved(deviceId: Int): Unit
Called whenever an input device has been removed from the system.
Parameters |
deviceId |
Int: The id of the input device 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.
[[["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,["# InputManager.InputDeviceListener\n\nAdded in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nInputDeviceListener\n===================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/hardware/input/InputManager.InputDeviceListener \"View this page in Java\") \n\n```\ninterface InputDeviceListener\n```\n\n|--------------------------------------------------------------|\n| [android.hardware.input.InputManager.InputDeviceListener](#) |\n\nListens for changes in input devices.\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onInputDeviceAdded](#onInputDeviceAdded(kotlin.Int))`(`deviceId:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Called whenever an input device has been added to the system. |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onInputDeviceChanged](#onInputDeviceChanged(kotlin.Int))`(`deviceId:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Called whenever the properties of an input device have changed since they were last queried. |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onInputDeviceRemoved](#onInputDeviceRemoved(kotlin.Int))`(`deviceId:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Called whenever an input device has been removed from the system. |\n\nPublic methods\n--------------\n\n### onInputDeviceAdded\n\nAdded in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onInputDeviceAdded(deviceId: Int): Unit\n```\n\nCalled whenever an input device has been added to the system. Use [getInputDevice(int)](/reference/kotlin/android/hardware/input/InputManager#getInputDevice(kotlin.Int)) to get more information about the device.\n\n| Parameters ||\n|------------|------------------------------------------------------------------------------------------------------------------------|\n| `deviceId` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The id of the input device that was added. |\n\n### onInputDeviceChanged\n\nAdded in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onInputDeviceChanged(deviceId: Int): Unit\n```\n\nCalled whenever the properties of an input device have changed since they were last queried. Use [InputManager.getInputDevice](/reference/kotlin/android/hardware/input/InputManager#getInputDevice(kotlin.Int)) to get a fresh [InputDevice](../../view/InputDevice.html#) object with the new properties.\n\n| Parameters ||\n|------------|----------------------------------------------------------------------------------------------------------------------|\n| `deviceId` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The id of the input device that changed. |\n\n### onInputDeviceRemoved\n\nAdded in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onInputDeviceRemoved(deviceId: Int): Unit\n```\n\nCalled whenever an input device has been removed from the system.\n\n| Parameters ||\n|------------|--------------------------------------------------------------------------------------------------------------------------|\n| `deviceId` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The id of the input device that was removed. |"]]