Share via


KeyEvent Constructors

Definition

Overloads

KeyEvent(KeyEvent)

Make an exact copy of an existing key event.

KeyEvent(KeyEventActions, Keycode)

Create a new key event.

KeyEvent(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

KeyEvent(KeyEvent, Int64, Int32)
Obsolete.

Copy an existing key event, modifying its time and repeat count.

KeyEvent(Int64, String, Int32, KeyEventFlags)

Create a new key event for a string of characters.

KeyEvent(Int64, Int64, KeyEventActions, Keycode, Int32)

Create a new key event.

KeyEvent(Int64, Int64, KeyEventActions, Keycode, Int32, MetaKeyStates)

Create a new key event.

KeyEvent(Int64, Int64, KeyEventActions, Keycode, Int32, MetaKeyStates, Int32, Int32)

Create a new key event.

KeyEvent(Int64, Int64, KeyEventActions, Keycode, Int32, MetaKeyStates, Int32, Int32, KeyEventFlags)

Create a new key event.

KeyEvent(Int64, Int64, KeyEventActions, Keycode, Int32, MetaKeyStates, Int32, Int32, KeyEventFlags, InputSourceType)

Create a new key event.

KeyEvent(KeyEvent)

Make an exact copy of an existing key event.

[Android.Runtime.Register(".ctor", "(Landroid/view/KeyEvent;)V", "")]
public KeyEvent (Android.Views.KeyEvent? origEvent);
[<Android.Runtime.Register(".ctor", "(Landroid/view/KeyEvent;)V", "")>]
new Android.Views.KeyEvent : Android.Views.KeyEvent -> Android.Views.KeyEvent

Parameters

origEvent
KeyEvent
Attributes

Remarks

Make an exact copy of an existing key event.

Java documentation for android.view.KeyEvent.KeyEvent(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

KeyEvent(KeyEventActions, Keycode)

Create a new key event.

[Android.Runtime.Register(".ctor", "(II)V", "")]
public KeyEvent (Android.Views.KeyEventActions action, Android.Views.Keycode code);
[<Android.Runtime.Register(".ctor", "(II)V", "")>]
new Android.Views.KeyEvent : Android.Views.KeyEventActions * Android.Views.Keycode -> Android.Views.KeyEvent

Parameters

action
KeyEventActions

Action code: either #ACTION_DOWN, #ACTION_UP, or #ACTION_MULTIPLE.

code
Keycode

The key code.

Attributes

Remarks

Create a new key event.

Java documentation for android.view.KeyEvent.KeyEvent(int, 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

KeyEvent(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

protected KeyEvent (IntPtr javaReference, Android.Runtime.JniHandleOwnership transfer);
new Android.Views.KeyEvent : nativeint * Android.Runtime.JniHandleOwnership -> Android.Views.KeyEvent

Parameters

javaReference
IntPtr

nativeint

A IntPtrcontaining a Java Native Interface (JNI) object reference.

transfer
JniHandleOwnership

A JniHandleOwnershipindicating how to handle javaReference

Remarks

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

KeyEvent(KeyEvent, Int64, Int32)

Caution

deprecated

Copy an existing key event, modifying its time and repeat count.

[Android.Runtime.Register(".ctor", "(Landroid/view/KeyEvent;JI)V", "")]
[System.Obsolete("deprecated")]
public KeyEvent (Android.Views.KeyEvent? origEvent, long eventTime, int newRepeat);
[<Android.Runtime.Register(".ctor", "(Landroid/view/KeyEvent;JI)V", "")>]
[<System.Obsolete("deprecated")>]
new Android.Views.KeyEvent : Android.Views.KeyEvent * int64 * int -> Android.Views.KeyEvent

Parameters

origEvent
KeyEvent

The existing event to be copied.

eventTime
Int64

The new event time (in android.os.SystemClock#uptimeMillis) of the event.

newRepeat
Int32

The new repeat count of the event.

Attributes

Remarks

Copy an existing key event, modifying its time and repeat count.

This member is deprecated. Use #changeTimeRepeat(KeyEvent, long, int) instead.

Java documentation for android.view.KeyEvent.KeyEvent(android.view.KeyEvent, long, 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

KeyEvent(Int64, String, Int32, KeyEventFlags)

Create a new key event for a string of characters.

[Android.Runtime.Register(".ctor", "(JLjava/lang/String;II)V", "")]
public KeyEvent (long time, string? characters, int deviceId, Android.Views.KeyEventFlags flags);
[<Android.Runtime.Register(".ctor", "(JLjava/lang/String;II)V", "")>]
new Android.Views.KeyEvent : int64 * string * int * Android.Views.KeyEventFlags -> Android.Views.KeyEvent

Parameters

time
Int64

The time (in android.os.SystemClock#uptimeMillis) at which this event occured.

characters
String

The string of characters.

deviceId
Int32

The device ID that generated the key event.

flags
KeyEventFlags

The flags for this key event

Attributes

Remarks

Create a new key event for a string of characters. The key code, action, repeat count and source will automatically be set to #KEYCODE_UNKNOWN, #ACTION_MULTIPLE, 0, and InputDevice#SOURCE_KEYBOARD for you.

Java documentation for android.view.KeyEvent.KeyEvent(long, java.lang.String, int, 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

KeyEvent(Int64, Int64, KeyEventActions, Keycode, Int32)

Create a new key event.

[Android.Runtime.Register(".ctor", "(JJIII)V", "")]
public KeyEvent (long downTime, long eventTime, Android.Views.KeyEventActions action, Android.Views.Keycode code, int repeat);
[<Android.Runtime.Register(".ctor", "(JJIII)V", "")>]
new Android.Views.KeyEvent : int64 * int64 * Android.Views.KeyEventActions * Android.Views.Keycode * int -> Android.Views.KeyEvent

Parameters

downTime
Int64

The time (in android.os.SystemClock#uptimeMillis) at which this key code originally went down.

eventTime
Int64

The time (in android.os.SystemClock#uptimeMillis) at which this event happened.

action
KeyEventActions

Action code: either #ACTION_DOWN, #ACTION_UP, or #ACTION_MULTIPLE.

code
Keycode

The key code.

repeat
Int32

A repeat count for down events (> 0 if this is after the initial down) or event count for multiple events.

Attributes

Remarks

Create a new key event.

Java documentation for android.view.KeyEvent.KeyEvent(long, long, int, int, 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

KeyEvent(Int64, Int64, KeyEventActions, Keycode, Int32, MetaKeyStates)

Create a new key event.

[Android.Runtime.Register(".ctor", "(JJIIII)V", "")]
public KeyEvent (long downTime, long eventTime, Android.Views.KeyEventActions action, Android.Views.Keycode code, int repeat, Android.Views.MetaKeyStates metaState);
[<Android.Runtime.Register(".ctor", "(JJIIII)V", "")>]
new Android.Views.KeyEvent : int64 * int64 * Android.Views.KeyEventActions * Android.Views.Keycode * int * Android.Views.MetaKeyStates -> Android.Views.KeyEvent

Parameters

downTime
Int64

The time (in android.os.SystemClock#uptimeMillis) at which this key code originally went down.

eventTime
Int64

The time (in android.os.SystemClock#uptimeMillis) at which this event happened.

action
KeyEventActions

Action code: either #ACTION_DOWN, #ACTION_UP, or #ACTION_MULTIPLE.

code
Keycode

The key code.

repeat
Int32

A repeat count for down events (> 0 if this is after the initial down) or event count for multiple events.

metaState
MetaKeyStates

Flags indicating which meta keys are currently pressed.

Attributes

Remarks

Create a new key event.

Java documentation for android.view.KeyEvent.KeyEvent(long, long, int, int, int, 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

KeyEvent(Int64, Int64, KeyEventActions, Keycode, Int32, MetaKeyStates, Int32, Int32)

Create a new key event.

[Android.Runtime.Register(".ctor", "(JJIIIIII)V", "")]
public KeyEvent (long downTime, long eventTime, Android.Views.KeyEventActions action, Android.Views.Keycode code, int repeat, Android.Views.MetaKeyStates metaState, int deviceId, int scancode);
[<Android.Runtime.Register(".ctor", "(JJIIIIII)V", "")>]
new Android.Views.KeyEvent : int64 * int64 * Android.Views.KeyEventActions * Android.Views.Keycode * int * Android.Views.MetaKeyStates * int * int -> Android.Views.KeyEvent

Parameters

downTime
Int64

The time (in android.os.SystemClock#uptimeMillis) at which this key code originally went down.

eventTime
Int64

The time (in android.os.SystemClock#uptimeMillis) at which this event happened.

action
KeyEventActions

Action code: either #ACTION_DOWN, #ACTION_UP, or #ACTION_MULTIPLE.

code
Keycode

The key code.

repeat
Int32

A repeat count for down events (> 0 if this is after the initial down) or event count for multiple events.

metaState
MetaKeyStates

Flags indicating which meta keys are currently pressed.

deviceId
Int32

The device ID that generated the key event.

scancode
Int32

Raw device scan code of the event.

Attributes

Remarks

Create a new key event.

Java documentation for android.view.KeyEvent.KeyEvent(long, long, int, int, int, int, int, 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

KeyEvent(Int64, Int64, KeyEventActions, Keycode, Int32, MetaKeyStates, Int32, Int32, KeyEventFlags)

Create a new key event.

[Android.Runtime.Register(".ctor", "(JJIIIIIII)V", "")]
public KeyEvent (long downTime, long eventTime, Android.Views.KeyEventActions action, Android.Views.Keycode code, int repeat, Android.Views.MetaKeyStates metaState, int deviceId, int scancode, Android.Views.KeyEventFlags flags);
[<Android.Runtime.Register(".ctor", "(JJIIIIIII)V", "")>]
new Android.Views.KeyEvent : int64 * int64 * Android.Views.KeyEventActions * Android.Views.Keycode * int * Android.Views.MetaKeyStates * int * int * Android.Views.KeyEventFlags -> Android.Views.KeyEvent

Parameters

downTime
Int64

The time (in android.os.SystemClock#uptimeMillis) at which this key code originally went down.

eventTime
Int64

The time (in android.os.SystemClock#uptimeMillis) at which this event happened.

action
KeyEventActions

Action code: either #ACTION_DOWN, #ACTION_UP, or #ACTION_MULTIPLE.

code
Keycode

The key code.

repeat
Int32

A repeat count for down events (> 0 if this is after the initial down) or event count for multiple events.

metaState
MetaKeyStates

Flags indicating which meta keys are currently pressed.

deviceId
Int32

The device ID that generated the key event.

scancode
Int32

Raw device scan code of the event.

flags
KeyEventFlags

The flags for this key event

Attributes

Remarks

Create a new key event.

Java documentation for android.view.KeyEvent.KeyEvent(long, long, int, int, int, int, int, int, 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

KeyEvent(Int64, Int64, KeyEventActions, Keycode, Int32, MetaKeyStates, Int32, Int32, KeyEventFlags, InputSourceType)

Create a new key event.

[Android.Runtime.Register(".ctor", "(JJIIIIIIII)V", "")]
public KeyEvent (long downTime, long eventTime, Android.Views.KeyEventActions action, Android.Views.Keycode code, int repeat, Android.Views.MetaKeyStates metaState, int deviceId, int scancode, Android.Views.KeyEventFlags flags, Android.Views.InputSourceType source);
[<Android.Runtime.Register(".ctor", "(JJIIIIIIII)V", "")>]
new Android.Views.KeyEvent : int64 * int64 * Android.Views.KeyEventActions * Android.Views.Keycode * int * Android.Views.MetaKeyStates * int * int * Android.Views.KeyEventFlags * Android.Views.InputSourceType -> Android.Views.KeyEvent

Parameters

downTime
Int64

The time (in android.os.SystemClock#uptimeMillis) at which this key code originally went down.

eventTime
Int64

The time (in android.os.SystemClock#uptimeMillis) at which this event happened.

action
KeyEventActions

Action code: either #ACTION_DOWN, #ACTION_UP, or #ACTION_MULTIPLE.

code
Keycode

The key code.

repeat
Int32

A repeat count for down events (> 0 if this is after the initial down) or event count for multiple events.

metaState
MetaKeyStates

Flags indicating which meta keys are currently pressed.

deviceId
Int32

The device ID that generated the key event.

scancode
Int32

Raw device scan code of the event.

flags
KeyEventFlags

The flags for this key event

source
InputSourceType

The input source such as InputDevice#SOURCE_KEYBOARD.

Attributes

Remarks

Create a new key event.

Java documentation for android.view.KeyEvent.KeyEvent(long, long, int, int, int, int, int, int, int, 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