Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.
added in API level 28

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

abstract boolean onUnhandledKeyEvent(View v, KeyEvent event)

Called when a hardware key is dispatched to a view after being unhandled during normal KeyEvent dispatch.

Public methods

onUnhandledKeyEvent

added in API level 28
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.