Java android.view KeyEvent fields, constructors, methods, implement or subclass

Example usage for Java android.view KeyEvent fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for android.view KeyEvent.

The text is from its open source code.

Field

intKEYCODE_UNKNOWN
Key code constant: Unknown key code.
intKEYCODE_SOFT_LEFT
Key code constant: Soft Left key.
intKEYCODE_SOFT_RIGHT
Key code constant: Soft Right key.
intKEYCODE_HOME
Key code constant: Home key.
intKEYCODE_BACK
Key code constant: Back key.
intKEYCODE_CALL
Key code constant: Call key.
intKEYCODE_ENDCALL
Key code constant: End Call key.
intKEYCODE_0
Key code constant: '0' key.
intKEYCODE_1
Key code constant: '1' key.
intKEYCODE_2
Key code constant: '2' key.
intKEYCODE_3
Key code constant: '3' key.
intKEYCODE_4
Key code constant: '4' key.
intKEYCODE_5
Key code constant: '5' key.
intKEYCODE_6
Key code constant: '6' key.
intKEYCODE_7
Key code constant: '7' key.
intKEYCODE_8
Key code constant: '8' key.
intKEYCODE_9
Key code constant: '9' key.
intKEYCODE_STAR
Key code constant: '*' key.
intKEYCODE_POUND
Key code constant: '#' key.
intKEYCODE_DPAD_UP
Key code constant: Directional Pad Up key.
intKEYCODE_DPAD_DOWN
Key code constant: Directional Pad Down key.
intKEYCODE_DPAD_LEFT
Key code constant: Directional Pad Left key.
intKEYCODE_DPAD_RIGHT
Key code constant: Directional Pad Right key.
intKEYCODE_DPAD_CENTER
Key code constant: Directional Pad Center key.
intKEYCODE_VOLUME_UP
Key code constant: Volume Up key.
intKEYCODE_VOLUME_DOWN
Key code constant: Volume Down key.
intKEYCODE_POWER
Key code constant: Power key.
intKEYCODE_CAMERA
Key code constant: Camera key.
intKEYCODE_CLEAR
Key code constant: Clear key.
intKEYCODE_A
Key code constant: 'A' key.
intKEYCODE_B
Key code constant: 'B' key.
intKEYCODE_C
Key code constant: 'C' key.
intKEYCODE_D
Key code constant: 'D' key.
intKEYCODE_E
Key code constant: 'E' key.
intKEYCODE_F
Key code constant: 'F' key.
intKEYCODE_G
Key code constant: 'G' key.
intKEYCODE_H
Key code constant: 'H' key.
intKEYCODE_I
Key code constant: 'I' key.
intKEYCODE_J
Key code constant: 'J' key.
intKEYCODE_K
Key code constant: 'K' key.
intKEYCODE_L
Key code constant: 'L' key.
intKEYCODE_M
Key code constant: 'M' key.
intKEYCODE_N
Key code constant: 'N' key.
intKEYCODE_O
Key code constant: 'O' key.
intKEYCODE_P
Key code constant: 'P' key.
intKEYCODE_Q
Key code constant: 'Q' key.
intKEYCODE_R
Key code constant: 'R' key.
intKEYCODE_S
Key code constant: 'S' key.
intKEYCODE_T
Key code constant: 'T' key.
intKEYCODE_U
Key code constant: 'U' key.
intKEYCODE_V
Key code constant: 'V' key.
intKEYCODE_W
Key code constant: 'W' key.
intKEYCODE_X
Key code constant: 'X' key.
intKEYCODE_Y
Key code constant: 'Y' key.
intKEYCODE_Z
Key code constant: 'Z' key.
intKEYCODE_COMMA
Key code constant: ',' key.
intKEYCODE_PERIOD
Key code constant: '.'
intKEYCODE_ALT_LEFT
Key code constant: Left Alt modifier key.
intKEYCODE_ALT_RIGHT
Key code constant: Right Alt modifier key.
intKEYCODE_SHIFT_LEFT
Key code constant: Left Shift modifier key.
intKEYCODE_SHIFT_RIGHT
Key code constant: Right Shift modifier key.
intKEYCODE_TAB
Key code constant: Tab key.
intKEYCODE_SPACE
Key code constant: Space key.
intKEYCODE_SYM
Key code constant: Symbol modifier key.
intKEYCODE_EXPLORER
Key code constant: Explorer special function key.
intKEYCODE_ENVELOPE
Key code constant: Envelope special function key.
intKEYCODE_ENTER
Key code constant: Enter key.
intKEYCODE_DEL
Key code constant: Backspace key.
intKEYCODE_GRAVE
Key code constant: '`' (backtick) key.
intKEYCODE_MINUS
Key code constant: '-'.
intKEYCODE_EQUALS
Key code constant: '=' key.
intKEYCODE_LEFT_BRACKET
Key code constant: '[' key.
intKEYCODE_RIGHT_BRACKET
Key code constant: ']' key.
intKEYCODE_BACKSLASH
Key code constant: '\' key.
intKEYCODE_SEMICOLON
Key code constant: ';' key.
intKEYCODE_APOSTROPHE
Key code constant: ''' (apostrophe) key.
intKEYCODE_SLASH
Key code constant: '/' key.
intKEYCODE_AT
Key code constant: '@' key.
intKEYCODE_NUM
Key code constant: Number modifier key.
intKEYCODE_HEADSETHOOK
Key code constant: Headset Hook key.
intKEYCODE_FOCUS
Key code constant: Camera Focus key.
intKEYCODE_PLUS
Key code constant: '+' key.
intKEYCODE_MENU
Key code constant: Menu key.
intKEYCODE_NOTIFICATION
Key code constant: Notification key.
intKEYCODE_SEARCH
Key code constant: Search key.
intKEYCODE_MEDIA_PLAY_PAUSE
Key code constant: Play/Pause media key.
intKEYCODE_MEDIA_STOP
Key code constant: Stop media key.
intKEYCODE_MEDIA_NEXT
Key code constant: Play Next media key.
intKEYCODE_MEDIA_PREVIOUS
Key code constant: Play Previous media key.
intKEYCODE_MEDIA_REWIND
Key code constant: Rewind media key.
intKEYCODE_MEDIA_FAST_FORWARD
Key code constant: Fast Forward media key.
intKEYCODE_MUTE
Key code constant: Mute key.
intKEYCODE_PAGE_UP
Key code constant: Page Up key.
intKEYCODE_PAGE_DOWN
Key code constant: Page Down key.
intKEYCODE_PICTSYMBOLS
Key code constant: Picture Symbols modifier key.
intKEYCODE_SWITCH_CHARSET
Key code constant: Switch Charset modifier key.
intKEYCODE_BUTTON_A
Key code constant: A Button key.
intKEYCODE_BUTTON_B
Key code constant: B Button key.
intKEYCODE_BUTTON_X
Key code constant: X Button key.
intKEYCODE_BUTTON_Y
Key code constant: Y Button key.
intKEYCODE_BUTTON_L1
Key code constant: L1 Button key.
intKEYCODE_BUTTON_R1
Key code constant: R1 Button key.
intKEYCODE_BUTTON_L2
Key code constant: L2 Button key.
intKEYCODE_BUTTON_R2
Key code constant: R2 Button key.
intKEYCODE_ESCAPE
Key code constant: Escape key.
intKEYCODE_FORWARD_DEL
Key code constant: Forward Delete key.
intKEYCODE_CTRL_LEFT
Key code constant: Left Control modifier key.
intKEYCODE_CTRL_RIGHT
Key code constant: Right Control modifier key.
intKEYCODE_META_LEFT
Key code constant: Left Meta modifier key.
intKEYCODE_MOVE_HOME
Key code constant: Home Movement key.
intKEYCODE_MOVE_END
Key code constant: End Movement key.
intKEYCODE_MEDIA_PLAY
Key code constant: Play media key.
intKEYCODE_MEDIA_PAUSE
Key code constant: Pause media key.
intKEYCODE_MEDIA_RECORD
Key code constant: Record media key.
intKEYCODE_F5
Key code constant: F5 key.
intKEYCODE_NUMPAD_0
Key code constant: Numeric keypad '0' key.
intKEYCODE_NUMPAD_1
Key code constant: Numeric keypad '1' key.
intKEYCODE_NUMPAD_2
Key code constant: Numeric keypad '2' key.
intKEYCODE_NUMPAD_3
Key code constant: Numeric keypad '3' key.
intKEYCODE_NUMPAD_4
Key code constant: Numeric keypad '4' key.
intKEYCODE_NUMPAD_5
Key code constant: Numeric keypad '5' key.
intKEYCODE_NUMPAD_6
Key code constant: Numeric keypad '6' key.
intKEYCODE_NUMPAD_7
Key code constant: Numeric keypad '7' key.
intKEYCODE_NUMPAD_8
Key code constant: Numeric keypad '8' key.
intKEYCODE_NUMPAD_9
Key code constant: Numeric keypad '9' key.
intKEYCODE_NUMPAD_DOT
Key code constant: Numeric keypad '.'
intKEYCODE_NUMPAD_ENTER
Key code constant: Numeric keypad Enter key.
intKEYCODE_VOLUME_MUTE
Key code constant: Volume Mute key.
intKEYCODE_INFO
Key code constant: Info key.
intKEYCODE_CHANNEL_UP
Key code constant: Channel up key.
intKEYCODE_CHANNEL_DOWN
Key code constant: Channel down key.
intKEYCODE_ZOOM_IN
Key code constant: Zoom in key.
intKEYCODE_ZOOM_OUT
Key code constant: Zoom out key.
intKEYCODE_GUIDE
Key code constant: Guide key.
intKEYCODE_BOOKMARK
Key code constant: Bookmark key.
intKEYCODE_CAPTIONS
Key code constant: Toggle captions key.
intKEYCODE_TV_INPUT
Key code constant: TV input key.
intKEYCODE_PROG_RED
Key code constant: Red "programmable" key.
intKEYCODE_PROG_GREEN
Key code constant: Green "programmable" key.
intKEYCODE_PROG_YELLOW
Key code constant: Yellow "programmable" key.
intKEYCODE_PROG_BLUE
Key code constant: Blue "programmable" key.
intKEYCODE_3D_MODE
Key code constant: 3D Mode key.
intKEYCODE_MUSIC
Key code constant: Music special function key.
intKEYCODE_MEDIA_AUDIO_TRACK
Key code constant: Audio Track key.
intKEYCODE_PAIRING
Key code constant: Pairing key.
intKEYCODE_VOICE_ASSIST
Key code constant: Voice Assist key.
intACTION_DOWN
#getAction value: the key has been pressed down.
intACTION_UP
#getAction value: the key has been released.
intACTION_MULTIPLE
#getAction value: multiple duplicate key events have occurred in a row, or a complex string is being delivered.
intMETA_ALT_ON

This mask is used to check whether one of the ALT meta keys is pressed.

intMETA_ALT_LEFT_ON

This mask is used to check whether the left ALT meta key is pressed.

intMETA_SHIFT_ON

This mask is used to check whether one of the SHIFT meta keys is pressed.

intMETA_SHIFT_LEFT_ON

This mask is used to check whether the left SHIFT meta key is pressed.

intMETA_SYM_ON

This mask is used to check whether the SYM meta key is pressed.

intMETA_FUNCTION_ON

This mask is used to check whether the FUNCTION meta key is pressed.

intMETA_CTRL_ON

This mask is used to check whether one of the CTRL meta keys is pressed.

intMETA_CTRL_LEFT_ON

This mask is used to check whether the left CTRL meta key is pressed.

intMETA_META_ON

This mask is used to check whether one of the META meta keys is pressed.

intMETA_META_LEFT_ON

This mask is used to check whether the left META meta key is pressed.

intMETA_ALT_MASK
This mask is a combination of #META_ALT_ON , #META_ALT_LEFT_ON and #META_ALT_RIGHT_ON .
intMETA_CTRL_MASK
This mask is a combination of #META_CTRL_ON , #META_CTRL_LEFT_ON and #META_CTRL_RIGHT_ON .
intMETA_META_MASK
This mask is a combination of #META_META_ON , #META_META_LEFT_ON and #META_META_RIGHT_ON .
intFLAG_SOFT_KEYBOARD
This mask is set if the key event was generated by a software keyboard.
intFLAG_KEEP_TOUCH_MODE
This mask is set if we don't want the key event to cause us to leave touch mode.
intFLAG_FROM_SYSTEM
This mask is set if an event was known to come from a trusted part of the system.
intFLAG_LONG_PRESS
This flag is set for the first key repeat that occurs after the long press timeout.
intFLAG_CANCELED_LONG_PRESS
Set when a key event has #FLAG_CANCELED set because a long press action was executed while it was down.

Constructor

Method

KeyEventchangeTimeRepeat(KeyEvent event, long eventTime, int newRepeat)
Create a new key event that is the same as the given one, but whose event time and repeat count are replaced with the given value.
booleandispatch(Callback receiver, DispatcherState state, Object target)
Deliver this key event to a Callback interface.
booleandispatch(Callback receiver)
intgetAction()
Retrieve the action of this key event.
StringgetCharacters()
For the special case of a #ACTION_MULTIPLE event with key code of #KEYCODE_UNKNOWN , this is a raw string of characters associated with the event.
intgetDeadChar(int accent, int c)
Get the character that is produced by putting accent on the character c.
InputDevicegetDevice()
Gets the device that this event came from.
intgetDeviceId()
chargetDisplayLabel()
Gets the primary character for this key.
longgetDownTime()
Retrieve the time of the most recent key down event, in the android.os.SystemClock#uptimeMillis time base.
longgetEventTime()
Retrieve the time this event occurred, in the android.os.SystemClock#uptimeMillis time base.
intgetFlags()
Returns the flags for this key event.
intgetKeyCode()
Retrieve the key code of the key event.
booleangetKeyData(KeyData results)
Get the character conversion data for a given key code.
chargetMatch(char[] chars)
Gets the first character in the character array that can be generated by the specified key code.
intgetMetaState()

Returns the state of the meta keys.

intgetModifiers()
Returns the state of the modifier keys.
chargetNumber()
Gets the number or symbol associated with the key.
intgetRepeatCount()
Retrieve the repeat count of the event.
intgetScanCode()
Retrieve the hardware key id of this key event.
intgetSource()
intgetUnicodeChar()
Gets the Unicode character generated by the specified key and meta key state combination.
intgetUnicodeChar(int metaState)
Gets the Unicode character generated by the specified key and meta key state combination.
booleanhasModifiers(int modifiers)
Returns true if only the specified modifiers keys are pressed.
booleanhasNoModifiers()
Returns true if no modifier keys are pressed.
booleanisAltPressed()

Returns the pressed state of the ALT meta key.

booleanisCanceled()
For #ACTION_UP events, indicates that the event has been canceled as per #FLAG_CANCELED .
booleanisCtrlPressed()

Returns the pressed state of the CTRL meta key.

booleanisFromSource(int source)
Determines whether the event is from the given source.
booleanisGamepadButton(int keyCode)
Returns true if the specified keycode is a gamepad button.
booleanisLongPress()
For #ACTION_DOWN events, indicates that the event has been canceled as per #FLAG_LONG_PRESS .
booleanisModifierKey(int keyCode)
Returns true if this key code is a modifier key.
booleanisNumLockOn()

Returns the locked state of the NUM LOCK meta key.

booleanisPrintingKey()
Returns true if this key produces a glyph.
booleanisShiftPressed()

Returns the pressed state of the SHIFT meta key.

booleanisSystem()
Is this a system key?
booleanisTracking()
For #ACTION_UP events, indicates that the event is still being tracked from its initial down event as per #FLAG_TRACKING .
StringkeyCodeToString(int keyCode)
Returns a string that represents the symbolic name of the specified keycode such as "KEYCODE_A", "KEYCODE_DPAD_UP", or an equivalent numeric constant such as "1001" if unknown.
booleanmetaStateHasModifiers(int metaState, int modifiers)
Returns true if only the specified modifier keys are pressed according to the specified meta state.
booleanmetaStateHasNoModifiers(int metaState)
Returns true if no modifiers keys are pressed according to the specified meta state.
voidstartTracking()
Call this during Callback#onKeyDown to have the system track the key through its final up (possibly including a long press).
StringtoString()