Stay organized with collections
Save and categorize content based on your preferences.
View.OnUnhandledKeyEventListener
public
static
interface
View.OnUnhandledKeyEventListener
android.view.View.OnUnhandledKeyEventListener
|
Interface definition for a callback to be invoked when a hardware key event hasn't
been handled by the view hierarchy.
Summary
Public methods
onUnhandledKeyEvent
public abstract boolean onUnhandledKeyEvent (View v,
KeyEvent event)
Called when a hardware key is dispatched to a view after being unhandled during normal
KeyEvent
dispatch.
Parameters |
v |
View : The view the key has been dispatched to. |
event |
KeyEvent : The KeyEvent object containing information about the event. |
Returns |
boolean |
true if the listener has consumed the event, false otherwise. |
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.OnUnhandledKeyEventListener\n\nAdded in [API level 28](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\nView.OnUnhandledKeyEventListener\n================================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/view/View.OnUnhandledKeyEventListener \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\nstatic\n\n\ninterface\nView.OnUnhandledKeyEventListener\n`\n\n\n`\n\n\n`\n\n|-----------------------------------------------|\n| android.view.View.OnUnhandledKeyEventListener |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nInterface definition for a callback to be invoked when a hardware key event hasn't\nbeen handled by the view hierarchy.\n\nSummary\n-------\n\n| ### Public methods ||\n|---------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract boolean` | ` `[onUnhandledKeyEvent](/reference/android/view/View.OnUnhandledKeyEventListener#onUnhandledKeyEvent(android.view.View,%20android.view.KeyEvent))`(`[View](/reference/android/view/View)` v, `[KeyEvent](/reference/android/view/KeyEvent)` event) ` Called when a hardware key is dispatched to a view after being unhandled during normal [KeyEvent](/reference/android/view/KeyEvent) dispatch. |\n\nPublic methods\n--------------\n\n### onUnhandledKeyEvent\n\nAdded in [API level 28](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract boolean onUnhandledKeyEvent (View v, \n KeyEvent event)\n```\n\nCalled when a hardware key is dispatched to a view after being unhandled during normal\n[KeyEvent](/reference/android/view/KeyEvent) dispatch.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|---------|--------------------------------------------------------------------------------|\n| `v` | `View`: The view the key has been dispatched to. \u003cbr /\u003e |\n| `event` | `KeyEvent`: The KeyEvent object containing information about the event. \u003cbr /\u003e |\n\n| Returns ||\n|-----------|--------------------------------------------------------------------------|\n| `boolean` | `true` if the listener has consumed the event, `false` otherwise. \u003cbr /\u003e |"]]