Android.App.Activity.OnKeyDown Method
Called when a key was pressed down and not handled by any of the views inside of the activity.

Syntax

[Android.Runtime.Register("onKeyDown", "(ILandroid/view/KeyEvent;)Z", "GetOnKeyDown_ILandroid_view_KeyEvent_Handler")]
public virtual bool OnKeyDown (Android.Views.Keycode keyCode, Android.Views.KeyEvent e)

See Also

Activity.OnKeyUp(Android.Views.Keycode, Android.Views.KeyEvent)
Android.Views.KeyEvent

Parameters

keyCode
The value in event.getKeyCode().
e
Description of the key event.

Returns

Documentation for this section has not yet been entered.

Remarks

Called when a key was pressed down and not handled by any of the views inside of the activity. So, for example, key presses while the cursor is inside a TextView will not trigger the event (unless it is a navigation to another object) because TextView handles its own key presses.

If the focused view didn't want this event, this method is called.

The default implementation takes care of Android.Views.KeyEvent.KEYCODE_BACK by calling Activity.OnBackPressed, though the behavior varies based on the application compatibility mode: for NoType:android/os/Build$VERSION_CODES;Href=../../../reference/android/os/Build.VERSION_CODES.html#ECLAIR or later applications, it will set up the dispatch to call Activity.OnKeyUp(Android.Views.Keycode, Android.Views.KeyEvent) where the action will be performed; for earlier applications, it will perform the action immediately in on-down, as those versions of the platform behaved.

Other additional default key handling may be performed if configured with Activity.SetDefaultKeyMode(DefaultKey).

[Android Documentation]

Requirements

Namespace: Android.App
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1