Condividi tramite


IDialogInterfaceOnKeyListener.OnKey Method

Definition

Called when a key is dispatched to a dialog.

[Android.Runtime.Register("onKey", "(Landroid/content/DialogInterface;ILandroid/view/KeyEvent;)Z", "GetOnKey_Landroid_content_DialogInterface_ILandroid_view_KeyEvent_Handler:Android.Content.IDialogInterfaceOnKeyListenerInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public bool OnKey (Android.Content.IDialogInterface? dialog, Android.Views.Keycode keyCode, Android.Views.KeyEvent? e);
[<Android.Runtime.Register("onKey", "(Landroid/content/DialogInterface;ILandroid/view/KeyEvent;)Z", "GetOnKey_Landroid_content_DialogInterface_ILandroid_view_KeyEvent_Handler:Android.Content.IDialogInterfaceOnKeyListenerInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member OnKey : Android.Content.IDialogInterface * Android.Views.Keycode * Android.Views.KeyEvent -> bool

Parameters

dialog
IDialogInterface

the dialog the key has been dispatched to

keyCode
Keycode

the code for the physical key that was pressed

e
KeyEvent

The KeyEvent object containing full information about the event.

Returns

true if the listener has consumed the event, false otherwise

Attributes

Remarks

Called when a key is dispatched to a dialog. This allows listeners to get a chance to respond before the dialog.

Java documentation for android.content.DialogInterface.OnKeyListener.onKey(android.content.DialogInterface, int, android.view.KeyEvent).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to