Compartilhar via


InputMethodService.SendDownUpKeyEvents(Keycode) Method

Definition

Send the given key event code (as defined by KeyEvent) to the current input connection is a key down + key up event pair.

[Android.Runtime.Register("sendDownUpKeyEvents", "(I)V", "GetSendDownUpKeyEvents_IHandler")]
public virtual void SendDownUpKeyEvents (Android.Views.Keycode keyEventCode);
[<Android.Runtime.Register("sendDownUpKeyEvents", "(I)V", "GetSendDownUpKeyEvents_IHandler")>]
abstract member SendDownUpKeyEvents : Android.Views.Keycode -> unit
override this.SendDownUpKeyEvents : Android.Views.Keycode -> unit

Parameters

keyEventCode
Keycode

The raw key code to send, as defined by KeyEvent.

Attributes

Remarks

Send the given key event code (as defined by KeyEvent) to the current input connection is a key down + key up event pair. The sent events have KeyEvent#FLAG_SOFT_KEYBOARD KeyEvent.FLAG_SOFT_KEYBOARD set, so that the recipient can identify them as coming from a software input method, and KeyEvent#FLAG_KEEP_TOUCH_MODE KeyEvent.FLAG_KEEP_TOUCH_MODE, so that they don't impact the current touch mode of the UI.

Note that it's discouraged to send such key events in normal operation; this is mainly for use with android.text.InputType#TYPE_NULL type text fields, or for non-rich input methods. A reasonably capable software input method should use the android.view.inputmethod.InputConnection#commitText family of methods to send text to an application, rather than sending key events.

Java documentation for android.inputmethodservice.InputMethodService.sendDownUpKeyEvents(int).

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