Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)
Android APIs
Added in API level 1
public static interface

DialogInterface.OnKeyListener

android.content.DialogInterface.OnKeyListener

Class Overview

Interface definition for a callback to be invoked when a key event is dispatched to this dialog. The callback will be invoked before the key event is given to the dialog.

Summary

Public Methods
abstract boolean onKey ( DialogInterface dialog, int keyCode, KeyEvent event)
Called when a key is dispatched to a dialog.

Public Methods

public abstract boolean onKey ( DialogInterface dialog, int keyCode, KeyEvent event)

Added in API level 1

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

Parameters
dialog The dialog the key has been dispatched to.
keyCode The code for the physical key that was pressed
event The KeyEvent object containing full information about the event.
Returns
  • True if the listener has consumed the event, false otherwise.