KeyEvent
open class KeyEvent : InputEvent, Parcelable
kotlin.Any | ||
↳ | android.view.InputEvent | |
↳ | android.view.KeyEvent |
Object used to report key and button events.
Each key press is described by a sequence of key events. A key press starts with a key event with ACTION_DOWN
. If the key is held sufficiently long that it repeats, then the initial down is followed additional key events with ACTION_DOWN
and a non-zero value for getRepeatCount()
. The last key event is a ACTION_UP
for the key up. If the key press is canceled, the key up event will have the FLAG_CANCELED
flag set.
Key events are generally accompanied by a key code (getKeyCode()
), scan code (getScanCode()
) and meta state (getMetaState()
). Key code constants are defined in this class. Scan code constants are raw device-specific codes obtained from the OS and so are not generally meaningful to applications unless interpreted using the KeyCharacterMap
. Meta states describe the pressed state of key modifiers such as META_SHIFT_ON
or META_ALT_ON
.
Key codes typically correspond one-to-one with individual keys on an input device. Many keys and key combinations serve quite different functions on different input devices so care must be taken when interpreting them. Always use the KeyCharacterMap
associated with the input device when mapping keys to characters. Be aware that there may be multiple key input devices active at the same time and each will have its own key character map.
As soft input methods can use multiple and inventive ways of inputting text, there is no guarantee that any key press on a soft keyboard will generate a key event: this is left to the IME's discretion, and in fact sending such events is discouraged. You should never rely on receiving KeyEvents for any key on a soft input method. In particular, the default software keyboard will never send any key event to any application targetting Jelly Bean or later, and will only send events for some presses of the delete and return keys to applications targetting Ice Cream Sandwich or earlier. Be aware that other software input methods may never send key events regardless of the version. Consider using editor actions like android.view.inputmethod.EditorInfo#IME_ACTION_DONE
if you need specific interaction with the software keyboard, as it gives more visibility to the user as to how your application will react to key presses.
When interacting with an IME, the framework may deliver key events with the special action ACTION_MULTIPLE
that either specifies that single repeated key code or a sequence of characters to insert.
In general, the framework cannot guarantee that the key events it delivers to a view always constitute complete key sequences since some events may be dropped or modified by containing views before they are delivered. The view implementation should be prepared to handle FLAG_CANCELED
and should tolerate anomalous situations such as receiving a new ACTION_DOWN
without first having received an ACTION_UP
for the prior key press.
Refer to InputDevice
for more information about how different kinds of input devices and sources represent keys and buttons.
Summary
Nested classes | |
---|---|
abstract | |
open |
Use with |
Constants | |
---|---|
static Int |
|
static Int | |
static Int |
|
static Int |
When associated with up key events, this indicates that the key press has been canceled. |
static Int |
Set when a key event has |
static Int |
This mask is used for compatibility, to identify enter keys that are coming from an IME whose enter key has been auto-labelled "next" or "done". |
static Int |
Set when a key event has been synthesized to implement default behavior for an event that the application did not handle. |
static Int |
This mask is set if an event was known to come from a trusted part of the system. |
static Int |
This mask is set if we don't want the key event to cause us to leave touch mode. |
static Int |
This flag is set for the first key repeat that occurs after the long press timeout. |
static Int |
This mask is set if the key event was generated by a software keyboard. |
static Int |
Set for |
static Int |
This key event was generated by a virtual (on-screen) hard key area. |
static Int |
This mask is set if the device woke because of this key event. |
static Int |
Key code constant: '0' key. |
static Int |
Key code constant: '1' key. |
static Int |
Key code constant: '11' key. |
static Int |
Key code constant: '12' key. |
static Int |
Key code constant: '2' key. |
static Int |
Key code constant: '3' key. |
static Int |
Key code constant: 3D Mode key. |
static Int |
Key code constant: '4' key. |
static Int |
Key code constant: '5' key. |
static Int |
Key code constant: '6' key. |
static Int |
Key code constant: '7' key. |
static Int |
Key code constant: '8' key. |
static Int |
Key code constant: '9' key. |
static Int |
Key code constant: 'A' key. |
static Int |
Key code constant: Show all apps |
static Int |
Key code constant: Left Alt modifier key. |
static Int |
Key code constant: Right Alt modifier key. |
static Int |
Key code constant: ''' (apostrophe) key. |
static Int |
Key code constant: App switch key. |
static Int |
Key code constant: Assist key. |
static Int |
Key code constant: '@' key. |
static Int |
Key code constant: A/V Receiver input key. |
static Int |
Key code constant: A/V Receiver power key. |
static Int |
Key code constant: 'B' key. |
static Int |
Key code constant: Back key. |
static Int |
Key code constant: '\' key. |
static Int |
Key code constant: Bookmark key. |
static Int |
Key code constant: Break / Pause key. |
static Int |
Key code constant: Brightness Down key. |
static Int |
Key code constant: Brightness Up key. |
static Int |
Key code constant: Generic Game Pad Button #1. |
static Int |
Key code constant: Generic Game Pad Button #10. |
static Int |
Key code constant: Generic Game Pad Button #11. |
static Int |
Key code constant: Generic Game Pad Button #12. |
static Int |
Key code constant: Generic Game Pad Button #13. |
static Int |
Key code constant: Generic Game Pad Button #14. |
static Int |
Key code constant: Generic Game Pad Button #15. |
static Int |
Key code constant: Generic Game Pad Button #16. |
static Int |
Key code constant: Generic Game Pad Button #2. |
static Int |
Key code constant: Generic Game Pad Button #3. |
static Int |
Key code constant: Generic Game Pad Button #4. |
static Int |
Key code constant: Generic Game Pad Button #5. |
static Int |
Key code constant: Generic Game Pad Button #6. |
static Int |
Key code constant: Generic Game Pad Button #7. |
static Int |
Key code constant: Generic Game Pad Button #8. |
static Int |
Key code constant: Generic Game Pad Button #9. |
static Int |
Key code constant: A Button key. |
static Int |
Key code constant: B Button key. |
static Int |
Key code constant: C Button key. |
static Int |
Key code constant: L1 Button key. |
static Int |
Key code constant: L2 Button key. |
static Int |
Key code constant: Mode Button key. |
static Int |
Key code constant: R1 Button key. |
static Int |
Key code constant: R2 Button key. |
static Int |
Key code constant: Select Button key. |
static Int |
Key code constant: Start Button key. |
static Int |
Key code constant: Left Thumb Button key. |
static Int |
Key code constant: Right Thumb Button key. |
static Int |
Key code constant: X Button key. |
static Int |
Key code constant: Y Button key. |
static Int |
Key code constant: Z Button key. |
static Int |
Key code constant: 'C' key. |
static Int |
Key code constant: Calculator special function key. |
static Int |
Key code constant: Calendar special function key. |
static Int |
Key code constant: Call key. |
static Int |
Key code constant: Camera key. |
static Int |
Key code constant: Caps Lock key. |
static Int |
Key code constant: Toggle captions key. |
static Int |
Key code constant: Channel down key. |
static Int |
Key code constant: Channel up key. |
static Int |
Key code constant: Clear key. |
static Int |
Key code constant: ',' key. |
static Int |
Key code constant: Contacts special function key. |
static Int |
Key code constant: Copy key. |
static Int |
Key code constant: Left Control modifier key. |
static Int |
Key code constant: Right Control modifier key. |
static Int |
Key code constant: Cut key. |
static Int |
Key code constant: 'D' key. |
static Int |
Key code constant: Backspace key. |
static Int |
Key code constant: Demo Application key #1. |
static Int |
Key code constant: Demo Application key #2. |
static Int |
Key code constant: Demo Application key #3. |
static Int |
Key code constant: Demo Application key #4. |
static Int |
Key code constant: Directional Pad Center key. |
static Int |
Key code constant: Directional Pad Down key. |
static Int |
Key code constant: Directional Pad Down-Left |
static Int |
Key code constant: Directional Pad Down-Right |
static Int |
Key code constant: Directional Pad Left key. |
static Int |
Key code constant: Directional Pad Right key. |
static Int |
Key code constant: Directional Pad Up key. |
static Int |
Key code constant: Directional Pad Up-Left |
static Int |
Key code constant: Directional Pad Up-Right |
static Int |
Key code constant: DVR key. |
static Int |
Key code constant: 'E' key. |
static Int |
Key code constant: Japanese alphanumeric key. |
static Int |
Key code constant: To open emoji picker |
static Int |
Key code constant: End Call key. |
static Int |
Key code constant: Enter key. |
static Int |
Key code constant: Envelope special function key. |
static Int |
Key code constant: '=' key. |
static Int |
Key code constant: Escape key. |
static Int |
Key code constant: Explorer special function key. |
static Int |
Key code constant: 'F' key. |
static Int |
Key code constant: F1 key. |
static Int |
Key code constant: F10 key. |
static Int |
Key code constant: F11 key. |
static Int |
Key code constant: F12 key. |
static Int |
Key code constant: F2 key. |
static Int |
Key code constant: F3 key. |
static Int |
Key code constant: F4 key. |
static Int |
Key code constant: F5 key. |
static Int |
Key code constant: F6 key. |
static Int |
Key code constant: F7 key. |
static Int |
Key code constant: F8 key. |
static Int |
Key code constant: F9 key. |
static Int |
Key code constant: Featured Application key #1. |
static Int |
Key code constant: Featured Application key #2. |
static Int |
Key code constant: Featured Application key #3. |
static Int |
Key code constant: Featured Application key #4. |
static Int |
Key code constant: Camera Focus key. |
static Int |
Key code constant: Forward key. |
static Int |
Key code constant: Forward Delete key. |
static Int |
Key code constant: Function modifier key. |
static Int |
Key code constant: 'G' key. |
static Int |
Key code constant: '`' (backtick) key. |
static Int |
Key code constant: Guide key. |
static Int |
Key code constant: 'H' key. |
static Int |
Key code constant: Headset Hook key. |
static Int |
Key code constant: Help key. |
static Int |
Key code constant: Japanese conversion key. |
static Int |
Key code constant: Home key. |
static Int |
Key code constant: 'I' key. |
static Int |
Key code constant: Info key. |
static Int |
Key code constant: Insert key. |
static Int |
Key code constant: 'J' key. |
static Int |
Key code constant: 'K' key. |
static Int |
Key code constant: Japanese kana key. |
static Int |
Key code constant: Japanese katakana / hiragana key. |
static Int |
Key code constant: Keyboard backlight down |
static Int |
Key code constant: Keyboard backlight toggle |
static Int |
Key code constant: Keyboard backlight up |
static Int |
Key code constant: 'L' key. |
static Int |
Key code constant: Language Switch key. |
static Int |
Key code constant: Last Channel key. |
static Int |
Key code constant: '[' key. |
static Int |
Key code constant: 'M' key. |
static Int |
Key code constant: A button whose usage can be customized by the user through the system. |
static Int |
Key code constant: A button whose usage can be customized by the user through the system. |
static Int |
Key code constant: A button whose usage can be customized by the user through the system. |
static Int |
Key code constant: A button whose usage can be customized by the user through the system. |
static Int |
Key code constant: Manner Mode key. |
static Int |
Key code constant: Audio Track key. |
static Int |
Key code constant: Close media key. |
static Int |
Key code constant: Eject media key. |
static Int |
Key code constant: Fast Forward media key. |
static Int |
Key code constant: Play Next media key. |
static Int |
Key code constant: Pause media key. |
static Int |
Key code constant: Play media key. |
static Int |
Key code constant: Play/Pause media key. |
static Int |
Key code constant: Play Previous media key. |
static Int |
Key code constant: Record media key. |
static Int |
Key code constant: Rewind media key. |
static Int |
Key code constant: Skip backward media key. |
static Int |
Key code constant: Skip forward media key. |
static Int |
Key code constant: Step backward media key. |
static Int |
Key code constant: Step forward media key. |
static Int |
Key code constant: Stop media key. |
static Int |
Key code constant: Media Top Menu key. |
static Int |
Key code constant: Menu key. |
static Int |
Key code constant: Left Meta modifier key. |
static Int |
Key code constant: Right Meta modifier key. |
static Int |
Key code constant: '-'. |
static Int |
Key code constant: End Movement key. |
static Int |
Key code constant: Home Movement key. |
static Int |
Key code constant: Japanese non-conversion key. |
static Int |
Key code constant: Music special function key. |
static Int |
Key code constant: Mute key. |
static Int |
Key code constant: 'N' key. |
static Int |
Key code constant: Navigate in key. |
static Int |
Key code constant: Navigate to next key. |
static Int |
Key code constant: Navigate out key. |
static Int |
Key code constant: Navigate to previous key. |
static Int |
Key code constant: Notification key. |
static Int |
Key code constant: Number modifier key. |
static Int |
Key code constant: Numeric keypad '0' key. |
static Int |
Key code constant: Numeric keypad '1' key. |
static Int |
Key code constant: Numeric keypad '2' key. |
static Int |
Key code constant: Numeric keypad '3' key. |
static Int |
Key code constant: Numeric keypad '4' key. |
static Int |
Key code constant: Numeric keypad '5' key. |
static Int |
Key code constant: Numeric keypad '6' key. |
static Int |
Key code constant: Numeric keypad '7' key. |
static Int |
Key code constant: Numeric keypad '8' key. |
static Int |
Key code constant: Numeric keypad '9' key. |
static Int |
Key code constant: Numeric keypad '+' key (for addition). |
static Int |
Key code constant: Numeric keypad ',' key (for decimals or digit grouping). |
static Int |
Key code constant: Numeric keypad '/' key (for division). |
static Int |
Key code constant: Numeric keypad '. |
static Int |
Key code constant: Numeric keypad Enter key. |
static Int |
Key code constant: Numeric keypad '=' key. |
static Int |
Key code constant: Numeric keypad '(' key. |
static Int |
Key code constant: Numeric keypad '*' key (for multiplication). |
static Int |
Key code constant: Numeric keypad ')' key. |
static Int |
Key code constant: Numeric keypad '-' key (for subtraction). |
static Int |
Key code constant: Num Lock key. |
static Int |
Key code constant: 'O' key. |
static Int |
Key code constant: 'P' key. |
static Int |
Key code constant: Page Down key. |
static Int |
Key code constant: Page Up key. |
static Int |
Key code constant: Pairing key. |
static Int |
Key code constant: Paste key. |
static Int |
Key code constant: '. |
static Int |
Key code constant: Picture Symbols modifier key. |
static Int |
Key code constant: '+' key. |
static Int |
Key code constant: '#' key. |
static Int |
Key code constant: Power key. |
static Int |
Key code constant: Used to switch current |
static Int |
Key code constant: Blue "programmable" key. |
static Int |
Key code constant: Green "programmable" key. |
static Int |
Key code constant: Red "programmable" key. |
static Int |
Key code constant: Yellow "programmable" key. |
static Int |
Key code constant: 'Q' key. |
static Int |
Key code constant: 'R' key. |
static Int |
Key code constant: To open recent apps view (a.k.a. Overview). |
static Int |
Key code constant: Refresh key. |
static Int |
Key code constant: ']' key. |
static Int |
Key code constant: Japanese Ro key. |
static Int |
Key code constant: 'S' key. |
static Int |
Key code constant: To take a screenshot This key is fully handled by the framework and will not be sent to the foreground app, unlike |
static Int |
Key code constant: Scroll Lock key. |
static Int |
Key code constant: Search key. |
static Int |
Key code constant: ';' key. |
static Int |
Key code constant: Settings key. |
static Int |
Key code constant: Left Shift modifier key. |
static Int |
Key code constant: Right Shift modifier key. |
static Int |
Key code constant: '/' key. |
static Int |
Key code constant: Sleep key. |
static Int |
Key code constant: Soft Left key. |
static Int |
Key code constant: Soft Right key. |
static Int |
Key code constant: put device to sleep unless a wakelock is held. |
static Int |
Key code constant: Space key. |
static Int |
Key code constant: '*' key. |
static Int |
Key code constant: Set-top-box input key. |
static Int |
Key code constant: Set-top-box power key. |
static Int |
Key code constant: Generic stem key 1 for Wear |
static Int |
Key code constant: Generic stem key 2 for Wear |
static Int |
Key code constant: Generic stem key 3 for Wear |
static Int |
Key code constant: Primary stem key for Wear Main power/reset button on watch. |
static Int |
Key code constant: The primary button on the barrel of a stylus. |
static Int |
Key code constant: The secondary button on the barrel of a stylus. |
static Int |
Key code constant: A button on the tail end of a stylus. |
static Int |
Key code constant: The tertiary button on the barrel of a stylus. |
static Int |
Key code constant: Switch Charset modifier key. |
static Int |
Key code constant: Symbol modifier key. |
static Int |
Key code constant: System Request / Print Screen key. |
static Int |
Key code constant: Consumed by the system for navigation down |
static Int |
Key code constant: Consumed by the system for navigation left |
static Int |
Key code constant: Consumed by the system for navigation right |
static Int |
Key code constant: Consumed by the system for navigation up |
static Int |
Key code constant: 'T' key. |
static Int |
Key code constant: Tab key. |
static Int |
Key code constant: Thumbs down key. |
static Int |
Key code constant: Thumbs up key. |
static Int |
Key code constant: TV key. |
static Int |
Key code constant: Antenna/Cable key. |
static Int |
Key code constant: Audio description key. |
static Int |
Key code constant: Audio description mixing volume down key. |
static Int |
Key code constant: Audio description mixing volume up key. |
static Int |
Key code constant: Contents menu key. |
static Int |
Key code constant: TV data service key. |
static Int |
Key code constant: TV input key. |
static Int |
Key code constant: Component #1 key. |
static Int |
Key code constant: Component #2 key. |
static Int |
Key code constant: Composite #1 key. |
static Int |
Key code constant: Composite #2 key. |
static Int |
Key code constant: HDMI #1 key. |
static Int |
Key code constant: HDMI #2 key. |
static Int |
Key code constant: HDMI #3 key. |
static Int |
Key code constant: HDMI #4 key. |
static Int |
Key code constant: VGA #1 key. |
static Int |
Key code constant: Media context menu key. |
static Int |
Key code constant: Toggle Network key. |
static Int |
Key code constant: Number entry key. |
static Int |
Key code constant: TV power key. |
static Int |
Key code constant: Radio key. |
static Int |
Key code constant: Satellite key. |
static Int |
Key code constant: BS key. |
static Int |
Key code constant: CS key. |
static Int |
Key code constant: BS/CS key. |
static Int |
Key code constant: Teletext key. |
static Int |
Key code constant: Analog Terrestrial key. |
static Int |
Key code constant: Digital Terrestrial key. |
static Int |
Key code constant: Timer programming key. |
static Int |
Key code constant: Zoom mode key. |
static Int |
Key code constant: 'U' key. |
static Int |
Key code constant: Unknown key code. |
static Int |
Key code constant: 'V' key. |
static Int |
Key code constant: Video Application key #1. |
static Int |
Key code constant: Video Application key #2. |
static Int |
Key code constant: Video Application key #3. |
static Int |
Key code constant: Video Application key #4. |
static Int |
Key code constant: Video Application key #5. |
static Int |
Key code constant: Video Application key #6. |
static Int |
Key code constant: Video Application key #7. |
static Int |
Key code constant: Video Application key #8. |
static Int |
Key code constant: Voice Assist key. |
static Int |
Key code constant: Volume Down key. |
static Int |
Key code constant: Volume Mute key. |
static Int |
Key code constant: Volume Up key. |
static Int |
Key code constant: 'W' key. |
static Int |
Key code constant: Wakeup key. |
static Int |
Key code constant: Window key. |
static Int |
Key code constant: 'X' key. |
static Int |
Key code constant: 'Y' key. |
static Int |
Key code constant: Japanese Yen key. |
static Int |
Key code constant: 'Z' key. |
static Int |
Key code constant: Japanese full-width / half-width key. |
static Int |
Key code constant: Zoom in key. |
static Int |
Key code constant: Zoom out key. |
static Int | |
static Int |
This mask is used to check whether the left ALT meta key is pressed. |
static Int |
This mask is a combination of |
static Int |
This mask is used to check whether one of the ALT meta keys is pressed. |
static Int |
This mask is used to check whether the right the ALT meta key is pressed. |
static Int |
This mask is used to check whether the CAPS LOCK meta key is on. |
static Int |
This mask is used to check whether the left CTRL meta key is pressed. |
static Int |
This mask is a combination of |
static Int |
This mask is used to check whether one of the CTRL meta keys is pressed. |
static Int |
This mask is used to check whether the right CTRL meta key is pressed. |
static Int |
This mask is used to check whether the FUNCTION meta key is pressed. |
static Int |
This mask is used to check whether the left META meta key is pressed. |
static Int |
This mask is a combination of |
static Int |
This mask is used to check whether one of the META meta keys is pressed. |
static Int |
This mask is used to check whether the right META meta key is pressed. |
static Int |
This mask is used to check whether the NUM LOCK meta key is on. |
static Int |
This mask is used to check whether the SCROLL LOCK meta key is on. |
static Int |
This mask is used to check whether the left SHIFT meta key is pressed. |
static Int |
This mask is a combination of |
static Int |
This mask is used to check whether one of the SHIFT meta keys is pressed. |
static Int |
This mask is used to check whether the right SHIFT meta key is pressed. |
static Int |
This mask is used to check whether the SYM meta key is pressed. |
Inherited constants | |
---|---|
Public constructors | |
---|---|
Make an exact copy of an existing key event. |
|
Copy an existing key event, modifying its time and repeat count. |
|
Create a new key event. |
|
Create a new key event for a string of characters. |
|
Create a new key event. |
|
Create a new key event. |
|
KeyEvent(downTime: Long, eventTime: Long, action: Int, code: Int, repeat: Int, metaState: Int, deviceId: Int, scancode: Int) Create a new key event. |
|
KeyEvent(downTime: Long, eventTime: Long, action: Int, code: Int, repeat: Int, metaState: Int, deviceId: Int, scancode: Int, flags: Int) Create a new key event. |
|
KeyEvent(downTime: Long, eventTime: Long, action: Int, code: Int, repeat: Int, metaState: Int, deviceId: Int, scancode: Int, flags: Int, source: Int) Create a new key event. |
Public methods | |
---|---|
open static KeyEvent! |
changeAction(event: KeyEvent!, action: Int) Create a new key event that is the same as the given one, but whose action is replaced with the given value. |
open static KeyEvent! |
changeFlags(event: KeyEvent!, flags: Int) Create a new key event that is the same as the given one, but whose flags are replaced with the given value. |
open static KeyEvent! |
changeTimeRepeat(event: KeyEvent!, eventTime: Long, newRepeat: Int) 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. |
open static KeyEvent! |
changeTimeRepeat(event: KeyEvent!, eventTime: Long, newRepeat: Int, newFlags: Int) 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. |
Boolean |
dispatch(receiver: KeyEvent.Callback!) |
Boolean |
dispatch(receiver: KeyEvent.Callback!, state: KeyEvent.DispatcherState!, target: Any!) Deliver this key event to a |
Int |
Retrieve the action of this key event. |
String! |
For the special case of a |
open static Int |
getDeadChar(accent: Int, c: Int) Get the character that is produced by putting accent on the character c. |
Int |
Gets the id for the device that this event came from. |
open Char |
Gets the primary character for this key. |
Long |
Retrieve the time of the most recent key down event, in the |
Long |
Retrieve the time this event occurred, in the |
Int |
getFlags() Returns the flags for this key event. |
KeyCharacterMap! |
Gets the |
Int |
Retrieve the key code of the key event. |
open Boolean |
getKeyData(results: KeyCharacterMap.KeyData!) Get the character conversion data for a given key code. |
open Char |
Gets the first character in the character array that can be generated by the specified key code. |
open Char |
Gets the first character in the character array that can be generated by the specified key code. |
open static Int |
Returns the maximum keycode. |
Int |
Returns the state of the meta keys. |
open static Int |
Gets a mask that includes all valid modifier key meta state bits. |
Int |
Returns the state of the modifier keys. |
open Char |
Gets the number or symbol associated with the key. |
Int |
Retrieve the repeat count of the event. |
Int |
Retrieve the hardware key id of this key event. |
Int |
Gets the source of the event. |
open Int |
Gets the Unicode character generated by the specified key and meta key state combination. |
open Int |
getUnicodeChar(metaState: Int) Gets the Unicode character generated by the specified key and meta key state combination. |
Boolean |
hasModifiers(modifiers: Int) Returns true if only the specified modifiers keys are pressed. |
Boolean |
Returns true if no modifier keys are pressed. |
Boolean |
Returns the pressed state of the ALT meta key. |
Boolean |
For |
Boolean |
Returns the locked state of the CAPS LOCK meta key. |
Boolean |
Returns the pressed state of the CTRL meta key. |
Boolean |
Returns the pressed state of the FUNCTION meta key. |
static Boolean |
isGamepadButton(keyCode: Int) Returns true if the specified keycode is a gamepad button. |
Boolean |
For |
static Boolean |
isMediaSessionKey(keyCode: Int) Returns whether this key will be sent to the if not handled. |
Boolean |
Returns the pressed state of the META meta key. |
open static Boolean |
isModifierKey(keyCode: Int) Returns true if this key code is a modifier key. |
Boolean |
Returns the locked state of the NUM LOCK meta key. |
open Boolean |
Returns true if this key produces a glyph. |
Boolean |
Returns the locked state of the SCROLL LOCK meta key. |
Boolean |
Returns the pressed state of the SHIFT meta key. |
Boolean |
Returns the pressed state of the SYM meta key. |
Boolean |
isSystem() Is this a system key? System keys can not be used for menu shortcuts. |
Boolean |
For |
open static Int |
keyCodeFromString(symbolicName: String) Gets a keycode by its symbolic name such as "KEYCODE_A" or an equivalent numeric constant such as "29". |
open static String! |
keyCodeToString(keyCode: Int) 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. |
open static Boolean |
metaStateHasModifiers(metaState: Int, modifiers: Int) Returns true if only the specified modifier keys are pressed according to the specified meta state. |
open static Boolean |
metaStateHasNoModifiers(metaState: Int) Returns true if no modifiers keys are pressed according to the specified meta state. |
open static Int |
normalizeMetaState(metaState: Int) Normalizes the specified meta state. |
Unit | |
Unit |
Call this during |
open String |
toString() |
open Unit |
writeToParcel(out: Parcel, flags: Int) |
Inherited functions | |
---|---|
Properties | |
---|---|
static Parcelable.Creator<KeyEvent!> |
Constants
ACTION_DOWN
static val ACTION_DOWN: Int
getAction
value: the key has been pressed down.
Value: 0
ACTION_MULTIPLE
static valACTION_MULTIPLE: Int
Deprecated: No longer used by the input system. getAction
value: multiple duplicate key events have occurred in a row, or a complex string is being delivered. If the key code is not KEYCODE_UNKNOWN
then the getRepeatCount()
method returns the number of times the given key code should be executed. Otherwise, if the key code is KEYCODE_UNKNOWN
, then this is a sequence of characters as returned by getCharacters
.
Value: 2
ACTION_UP
static val ACTION_UP: Int
getAction
value: the key has been released.
Value: 1
FLAG_CANCELED
static val FLAG_CANCELED: Int
When associated with up key events, this indicates that the key press has been canceled. Typically this is used with virtual touch screen keys, where the user can slide from the virtual key area on to the display: in that case, the application will receive a canceled up event and should not perform the action normally associated with the key. Note that for this to work, the application can not perform an action for a key until it receives an up or the long press timeout has expired.
Value: 32
FLAG_CANCELED_LONG_PRESS
static val FLAG_CANCELED_LONG_PRESS: Int
Set when a key event has FLAG_CANCELED
set because a long press action was executed while it was down.
Value: 256
FLAG_EDITOR_ACTION
static val FLAG_EDITOR_ACTION: Int
This mask is used for compatibility, to identify enter keys that are coming from an IME whose enter key has been auto-labelled "next" or "done". This allows TextView to dispatch these as normal enter keys for old applications, but still do the appropriate action when receiving them.
Value: 16
FLAG_FALLBACK
static val FLAG_FALLBACK: Int
Set when a key event has been synthesized to implement default behavior for an event that the application did not handle. Fallback key events are generated by unhandled trackball motions (to emulate a directional keypad) and by certain unhandled key presses that are declared in the key map (such as special function numeric keypad keys when numlock is off).
Value: 1024
FLAG_FROM_SYSTEM
static val FLAG_FROM_SYSTEM: Int
This mask is set if an event was known to come from a trusted part of the system. That is, the event is known to come from the user, and could not have been spoofed by a third party component.
Value: 8
FLAG_KEEP_TOUCH_MODE
static val FLAG_KEEP_TOUCH_MODE: Int
This mask is set if we don't want the key event to cause us to leave touch mode.
Value: 4
FLAG_LONG_PRESS
static val FLAG_LONG_PRESS: Int
This flag is set for the first key repeat that occurs after the long press timeout.
Value: 128
FLAG_SOFT_KEYBOARD
static val FLAG_SOFT_KEYBOARD: Int
This mask is set if the key event was generated by a software keyboard.
Value: 2
FLAG_TRACKING
static val FLAG_TRACKING: Int
Set for ACTION_UP
when this event's key code is still being tracked from its initial down. That is, somebody requested that tracking started on the key down and a long press has not caused the tracking to be canceled.
Value: 512
FLAG_VIRTUAL_HARD_KEY
static val FLAG_VIRTUAL_HARD_KEY: Int
This key event was generated by a virtual (on-screen) hard key area. Typically this is an area of the touchscreen, outside of the regular display, dedicated to "hardware" buttons.
Value: 64
FLAG_WOKE_HERE
static valFLAG_WOKE_HERE: Int
Deprecated: This flag will never be set by the system since the system consumes all wake keys itself.
This mask is set if the device woke because of this key event.
Value: 1
KEYCODE_3D_MODE
static val KEYCODE_3D_MODE: Int
Key code constant: 3D Mode key. Toggles the display between 2D and 3D mode.
Value: 206
KEYCODE_ALL_APPS
static val KEYCODE_ALL_APPS: Int
Key code constant: Show all apps
Value: 284
KEYCODE_ALT_LEFT
static val KEYCODE_ALT_LEFT: Int
Key code constant: Left Alt modifier key.
Value: 57
KEYCODE_ALT_RIGHT
static val KEYCODE_ALT_RIGHT: Int
Key code constant: Right Alt modifier key.
Value: 58
KEYCODE_APOSTROPHE
static val KEYCODE_APOSTROPHE: Int
Key code constant: ''' (apostrophe) key.
Value: 75
KEYCODE_APP_SWITCH
static val KEYCODE_APP_SWITCH: Int
Key code constant: App switch key. Should bring up the application switcher dialog.
Value: 187
KEYCODE_ASSIST
static val KEYCODE_ASSIST: Int
Key code constant: Assist key. Launches the global assist activity. Not delivered to applications.
Value: 219
KEYCODE_AVR_INPUT
static val KEYCODE_AVR_INPUT: Int
Key code constant: A/V Receiver input key. On TV remotes, switches the input mode on an external A/V Receiver.
Value: 182
KEYCODE_AVR_POWER
static val KEYCODE_AVR_POWER: Int
Key code constant: A/V Receiver power key. On TV remotes, toggles the power on an external A/V Receiver.
Value: 181
KEYCODE_BACK
static val KEYCODE_BACK: Int
Key code constant: Back key.
Value: 4
KEYCODE_BACKSLASH
static val KEYCODE_BACKSLASH: Int
Key code constant: '\' key.
Value: 73
KEYCODE_BOOKMARK
static val KEYCODE_BOOKMARK: Int
Key code constant: Bookmark key. On some TV remotes, bookmarks content or web pages.
Value: 174
KEYCODE_BREAK
static val KEYCODE_BREAK: Int
Key code constant: Break / Pause key.
Value: 121
KEYCODE_BRIGHTNESS_DOWN
static val KEYCODE_BRIGHTNESS_DOWN: Int
Key code constant: Brightness Down key. Adjusts the screen brightness down.
Value: 220
KEYCODE_BRIGHTNESS_UP
static val KEYCODE_BRIGHTNESS_UP: Int
Key code constant: Brightness Up key. Adjusts the screen brightness up.
Value: 221
KEYCODE_BUTTON_1
static val KEYCODE_BUTTON_1: Int
Key code constant: Generic Game Pad Button #1.
Value: 188
KEYCODE_BUTTON_10
static val KEYCODE_BUTTON_10: Int
Key code constant: Generic Game Pad Button #10.
Value: 197
KEYCODE_BUTTON_11
static val KEYCODE_BUTTON_11: Int
Key code constant: Generic Game Pad Button #11.
Value: 198
KEYCODE_BUTTON_12
static val KEYCODE_BUTTON_12: Int
Key code constant: Generic Game Pad Button #12.
Value: 199
KEYCODE_BUTTON_13
static val KEYCODE_BUTTON_13: Int
Key code constant: Generic Game Pad Button #13.
Value: 200
KEYCODE_BUTTON_14
static val KEYCODE_BUTTON_14: Int
Key code constant: Generic Game Pad Button #14.
Value: 201
KEYCODE_BUTTON_15
static val KEYCODE_BUTTON_15: Int
Key code constant: Generic Game Pad Button #15.
Value: 202
KEYCODE_BUTTON_16
static val KEYCODE_BUTTON_16: Int
Key code constant: Generic Game Pad Button #16.
Value: 203
KEYCODE_BUTTON_2
static val KEYCODE_BUTTON_2: Int
Key code constant: Generic Game Pad Button #2.
Value: 189
KEYCODE_BUTTON_3
static val KEYCODE_BUTTON_3: Int
Key code constant: Generic Game Pad Button #3.
Value: 190
KEYCODE_BUTTON_4
static val KEYCODE_BUTTON_4: Int
Key code constant: Generic Game Pad Button #4.
Value: 191
KEYCODE_BUTTON_5
static val KEYCODE_BUTTON_5: Int
Key code constant: Generic Game Pad Button #5.
Value: 192
KEYCODE_BUTTON_6
static val KEYCODE_BUTTON_6: Int
Key code constant: Generic Game Pad Button #6.
Value: 193
KEYCODE_BUTTON_7
static val KEYCODE_BUTTON_7: Int
Key code constant: Generic Game Pad Button #7.
Value: 194
KEYCODE_BUTTON_8
static val KEYCODE_BUTTON_8: Int
Key code constant: Generic Game Pad Button #8.
Value: 195
KEYCODE_BUTTON_9
static val KEYCODE_BUTTON_9: Int
Key code constant: Generic Game Pad Button #9.
Value: 196
KEYCODE_BUTTON_A
static val KEYCODE_BUTTON_A: Int
Key code constant: A Button key. On a game controller, the A button should be either the button labeled A or the first button on the bottom row of controller buttons.
Value: 96
KEYCODE_BUTTON_B
static val KEYCODE_BUTTON_B: Int
Key code constant: B Button key. On a game controller, the B button should be either the button labeled B or the second button on the bottom row of controller buttons.
Value: 97
KEYCODE_BUTTON_C
static val KEYCODE_BUTTON_C: Int
Key code constant: C Button key. On a game controller, the C button should be either the button labeled C or the third button on the bottom row of controller buttons.
Value: 98
KEYCODE_BUTTON_L1
static val KEYCODE_BUTTON_L1: Int
Key code constant: L1 Button key. On a game controller, the L1 button should be either the button labeled L1 (or L) or the top left trigger button.
Value: 102
KEYCODE_BUTTON_L2
static val KEYCODE_BUTTON_L2: Int
Key code constant: L2 Button key. On a game controller, the L2 button should be either the button labeled L2 or the bottom left trigger button.
Value: 104
KEYCODE_BUTTON_MODE
static val KEYCODE_BUTTON_MODE: Int
Key code constant: Mode Button key. On a game controller, the button labeled Mode.
Value: 110
KEYCODE_BUTTON_R1
static val KEYCODE_BUTTON_R1: Int
Key code constant: R1 Button key. On a game controller, the R1 button should be either the button labeled R1 (or R) or the top right trigger button.
Value: 103
KEYCODE_BUTTON_R2
static val KEYCODE_BUTTON_R2: Int
Key code constant: R2 Button key. On a game controller, the R2 button should be either the button labeled R2 or the bottom right trigger button.
Value: 105
KEYCODE_BUTTON_SELECT
static val KEYCODE_BUTTON_SELECT: Int
Key code constant: Select Button key. On a game controller, the button labeled Select.
Value: 109
KEYCODE_BUTTON_START
static val KEYCODE_BUTTON_START: Int
Key code constant: Start Button key. On a game controller, the button labeled Start.
Value: 108
KEYCODE_BUTTON_THUMBL
static val KEYCODE_BUTTON_THUMBL: Int
Key code constant: Left Thumb Button key. On a game controller, the left thumb button indicates that the left (or only) joystick is pressed.
Value: 106
KEYCODE_BUTTON_THUMBR
static val KEYCODE_BUTTON_THUMBR: Int
Key code constant: Right Thumb Button key. On a game controller, the right thumb button indicates that the right joystick is pressed.
Value: 107
KEYCODE_BUTTON_X
static val KEYCODE_BUTTON_X: Int
Key code constant: X Button key. On a game controller, the X button should be either the button labeled X or the first button on the upper row of controller buttons.
Value: 99
KEYCODE_BUTTON_Y
static val KEYCODE_BUTTON_Y: Int
Key code constant: Y Button key. On a game controller, the Y button should be either the button labeled Y or the second button on the upper row of controller buttons.
Value: 100
KEYCODE_BUTTON_Z
static val KEYCODE_BUTTON_Z: Int
Key code constant: Z Button key. On a game controller, the Z button should be either the button labeled Z or the third button on the upper row of controller buttons.
Value: 101
KEYCODE_CALCULATOR
static val KEYCODE_CALCULATOR: Int
Key code constant: Calculator special function key. Used to launch a calculator application.
Value: 210
KEYCODE_CALENDAR
static val KEYCODE_CALENDAR: Int
Key code constant: Calendar special function key. Used to launch a calendar application.
Value: 208
KEYCODE_CALL
static val KEYCODE_CALL: Int
Key code constant: Call key.
Value: 5
KEYCODE_CAMERA
static val KEYCODE_CAMERA: Int
Key code constant: Camera key. Used to launch a camera application or take pictures.
Value: 27
KEYCODE_CAPS_LOCK
static val KEYCODE_CAPS_LOCK: Int
Key code constant: Caps Lock key.
Value: 115
KEYCODE_CAPTIONS
static val KEYCODE_CAPTIONS: Int
Key code constant: Toggle captions key. Switches the mode for closed-captioning text, for example during television shows.
Value: 175
KEYCODE_CHANNEL_DOWN
static val KEYCODE_CHANNEL_DOWN: Int
Key code constant: Channel down key. On TV remotes, decrements the television channel.
Value: 167
KEYCODE_CHANNEL_UP
static val KEYCODE_CHANNEL_UP: Int
Key code constant: Channel up key. On TV remotes, increments the television channel.
Value: 166
KEYCODE_CLEAR
static val KEYCODE_CLEAR: Int
Key code constant: Clear key.
Value: 28
KEYCODE_COMMA
static val KEYCODE_COMMA: Int
Key code constant: ',' key.
Value: 55
KEYCODE_CONTACTS
static val KEYCODE_CONTACTS: Int
Key code constant: Contacts special function key. Used to launch an address book application.
Value: 207
KEYCODE_COPY
static val KEYCODE_COPY: Int
Key code constant: Copy key.
Value: 278
KEYCODE_CTRL_LEFT
static val KEYCODE_CTRL_LEFT: Int
Key code constant: Left Control modifier key.
Value: 113
KEYCODE_CTRL_RIGHT
static val KEYCODE_CTRL_RIGHT: Int
Key code constant: Right Control modifier key.
Value: 114
KEYCODE_CUT
static val KEYCODE_CUT: Int
Key code constant: Cut key.
Value: 277
KEYCODE_DEL
static val KEYCODE_DEL: Int
Key code constant: Backspace key. Deletes characters before the insertion point, unlike KEYCODE_FORWARD_DEL
.
Value: 67
KEYCODE_DEMO_APP_1
static val KEYCODE_DEMO_APP_1: Int
Key code constant: Demo Application key #1.
Value: 301
KEYCODE_DEMO_APP_2
static val KEYCODE_DEMO_APP_2: Int
Key code constant: Demo Application key #2.
Value: 302
KEYCODE_DEMO_APP_3
static val KEYCODE_DEMO_APP_3: Int
Key code constant: Demo Application key #3.
Value: 303
KEYCODE_DEMO_APP_4
static val KEYCODE_DEMO_APP_4: Int
Key code constant: Demo Application key #4.
Value: 304
KEYCODE_DPAD_CENTER
static val KEYCODE_DPAD_CENTER: Int
Key code constant: Directional Pad Center key. May also be synthesized from trackball motions.
Value: 23
KEYCODE_DPAD_DOWN
static val KEYCODE_DPAD_DOWN: Int
Key code constant: Directional Pad Down key. May also be synthesized from trackball motions.
Value: 20
KEYCODE_DPAD_DOWN_LEFT
static val KEYCODE_DPAD_DOWN_LEFT: Int
Key code constant: Directional Pad Down-Left
Value: 269
KEYCODE_DPAD_DOWN_RIGHT
static val KEYCODE_DPAD_DOWN_RIGHT: Int
Key code constant: Directional Pad Down-Right
Value: 271
KEYCODE_DPAD_LEFT
static val KEYCODE_DPAD_LEFT: Int
Key code constant: Directional Pad Left key. May also be synthesized from trackball motions.
Value: 21
KEYCODE_DPAD_RIGHT
static val KEYCODE_DPAD_RIGHT: Int
Key code constant: Directional Pad Right key. May also be synthesized from trackball motions.
Value: 22
KEYCODE_DPAD_UP
static val KEYCODE_DPAD_UP: Int
Key code constant: Directional Pad Up key. May also be synthesized from trackball motions.
Value: 19
KEYCODE_DPAD_UP_LEFT
static val KEYCODE_DPAD_UP_LEFT: Int
Key code constant: Directional Pad Up-Left
Value: 268
KEYCODE_DPAD_UP_RIGHT
static val KEYCODE_DPAD_UP_RIGHT: Int
Key code constant: Directional Pad Up-Right
Value: 270
KEYCODE_DVR
static val KEYCODE_DVR: Int
Key code constant: DVR key. On some TV remotes, switches to a DVR mode for recorded shows.
Value: 173
KEYCODE_EISU
static val KEYCODE_EISU: Int
Key code constant: Japanese alphanumeric key.
Value: 212
KEYCODE_EMOJI_PICKER
static val KEYCODE_EMOJI_PICKER: Int
Key code constant: To open emoji picker
Value: 317
KEYCODE_ENDCALL
static val KEYCODE_ENDCALL: Int
Key code constant: End Call key.
Value: 6
KEYCODE_ENTER
static val KEYCODE_ENTER: Int
Key code constant: Enter key.
Value: 66
KEYCODE_ENVELOPE
static val KEYCODE_ENVELOPE: Int
Key code constant: Envelope special function key. Used to launch a mail application.
Value: 65
KEYCODE_EQUALS
static val KEYCODE_EQUALS: Int
Key code constant: '=' key.
Value: 70
KEYCODE_ESCAPE
static val KEYCODE_ESCAPE: Int
Key code constant: Escape key.
Value: 111
KEYCODE_EXPLORER
static val KEYCODE_EXPLORER: Int
Key code constant: Explorer special function key. Used to launch a browser application.
Value: 64
KEYCODE_F10
static val KEYCODE_F10: Int
Key code constant: F10 key.
Value: 140
KEYCODE_F11
static val KEYCODE_F11: Int
Key code constant: F11 key.
Value: 141
KEYCODE_F12
static val KEYCODE_F12: Int
Key code constant: F12 key.
Value: 142
KEYCODE_FEATURED_APP_1
static val KEYCODE_FEATURED_APP_1: Int
Key code constant: Featured Application key #1.
Value: 297
KEYCODE_FEATURED_APP_2
static val KEYCODE_FEATURED_APP_2: Int
Key code constant: Featured Application key #2.
Value: 298
KEYCODE_FEATURED_APP_3
static val KEYCODE_FEATURED_APP_3: Int
Key code constant: Featured Application key #3.
Value: 299
KEYCODE_FEATURED_APP_4
static val KEYCODE_FEATURED_APP_4: Int
Key code constant: Featured Application key #4.
Value: 300
KEYCODE_FOCUS
static val KEYCODE_FOCUS: Int
Key code constant: Camera Focus key. Used to focus the camera.
Value: 80
KEYCODE_FORWARD
static val KEYCODE_FORWARD: Int
Key code constant: Forward key. Navigates forward in the history stack. Complement of KEYCODE_BACK
.
Value: 125
KEYCODE_FORWARD_DEL
static val KEYCODE_FORWARD_DEL: Int
Key code constant: Forward Delete key. Deletes characters ahead of the insertion point, unlike KEYCODE_DEL
.
Value: 112
KEYCODE_FUNCTION
static val KEYCODE_FUNCTION: Int
Key code constant: Function modifier key.
Value: 119
KEYCODE_GRAVE
static val KEYCODE_GRAVE: Int
Key code constant: '`' (backtick) key.
Value: 68
KEYCODE_GUIDE
static val KEYCODE_GUIDE: Int
Key code constant: Guide key. On TV remotes, shows a programming guide.
Value: 172
KEYCODE_HEADSETHOOK
static val KEYCODE_HEADSETHOOK: Int
Key code constant: Headset Hook key. Used to hang up calls and stop media.
Value: 79
KEYCODE_HELP
static val KEYCODE_HELP: Int
Key code constant: Help key.
Value: 259
KEYCODE_HENKAN
static val KEYCODE_HENKAN: Int
Key code constant: Japanese conversion key.
Value: 214
KEYCODE_HOME
static val KEYCODE_HOME: Int
Key code constant: Home key. This key is handled by the framework and is never delivered to applications.
Value: 3
KEYCODE_INFO
static val KEYCODE_INFO: Int
Key code constant: Info key. Common on TV remotes to show additional information related to what is currently being viewed.
Value: 165
KEYCODE_INSERT
static val KEYCODE_INSERT: Int
Key code constant: Insert key. Toggles insert / overwrite edit mode.
Value: 124
KEYCODE_KANA
static val KEYCODE_KANA: Int
Key code constant: Japanese kana key.
Value: 218
KEYCODE_KATAKANA_HIRAGANA
static val KEYCODE_KATAKANA_HIRAGANA: Int
Key code constant: Japanese katakana / hiragana key.
Value: 215
KEYCODE_KEYBOARD_BACKLIGHT_DOWN
static val KEYCODE_KEYBOARD_BACKLIGHT_DOWN: Int
Key code constant: Keyboard backlight down
Value: 305
KEYCODE_KEYBOARD_BACKLIGHT_TOGGLE
static val KEYCODE_KEYBOARD_BACKLIGHT_TOGGLE: Int
Key code constant: Keyboard backlight toggle
Value: 307
KEYCODE_KEYBOARD_BACKLIGHT_UP
static val KEYCODE_KEYBOARD_BACKLIGHT_UP: Int
Key code constant: Keyboard backlight up
Value: 306
KEYCODE_LANGUAGE_SWITCH
static val KEYCODE_LANGUAGE_SWITCH: Int
Key code constant: Language Switch key. Toggles the current input language such as switching between English and Japanese on a QWERTY keyboard. On some devices, the same function may be performed by pressing Shift+Spacebar.
Value: 204
KEYCODE_LAST_CHANNEL
static val KEYCODE_LAST_CHANNEL: Int
Key code constant: Last Channel key. Goes to the last viewed channel.
Value: 229
KEYCODE_LEFT_BRACKET
static val KEYCODE_LEFT_BRACKET: Int
Key code constant: '[' key.
Value: 71
KEYCODE_MACRO_1
static val KEYCODE_MACRO_1: Int
Key code constant: A button whose usage can be customized by the user through the system. User customizable key #1.
Value: 313
KEYCODE_MACRO_2
static val KEYCODE_MACRO_2: Int
Key code constant: A button whose usage can be customized by the user through the system. User customizable key #2.
Value: 314
KEYCODE_MACRO_3
static val KEYCODE_MACRO_3: Int
Key code constant: A button whose usage can be customized by the user through the system. User customizable key #3.
Value: 315
KEYCODE_MACRO_4
static val KEYCODE_MACRO_4: Int
Key code constant: A button whose usage can be customized by the user through the system. User customizable key #4.
Value: 316
KEYCODE_MANNER_MODE
static val KEYCODE_MANNER_MODE: Int
Key code constant: Manner Mode key. Toggles silent or vibrate mode on and off to make the device behave more politely in certain settings such as on a crowded train. On some devices, the key may only operate when long-pressed.
Value: 205
KEYCODE_MEDIA_AUDIO_TRACK
static val KEYCODE_MEDIA_AUDIO_TRACK: Int
Key code constant: Audio Track key. Switches the audio tracks.
Value: 222
KEYCODE_MEDIA_CLOSE
static val KEYCODE_MEDIA_CLOSE: Int
Key code constant: Close media key. May be used to close a CD tray, for example.
Value: 128
KEYCODE_MEDIA_EJECT
static val KEYCODE_MEDIA_EJECT: Int
Key code constant: Eject media key. May be used to eject a CD tray, for example.
Value: 129
KEYCODE_MEDIA_FAST_FORWARD
static val KEYCODE_MEDIA_FAST_FORWARD: Int
Key code constant: Fast Forward media key.
Value: 90
KEYCODE_MEDIA_NEXT
static val KEYCODE_MEDIA_NEXT: Int
Key code constant: Play Next media key.
Value: 87
KEYCODE_MEDIA_PAUSE
static val KEYCODE_MEDIA_PAUSE: Int
Key code constant: Pause media key.
Value: 127
KEYCODE_MEDIA_PLAY
static val KEYCODE_MEDIA_PLAY: Int
Key code constant: Play media key.
Value: 126
KEYCODE_MEDIA_PLAY_PAUSE
static val KEYCODE_MEDIA_PLAY_PAUSE: Int
Key code constant: Play/Pause media key.
Value: 85
KEYCODE_MEDIA_PREVIOUS
static val KEYCODE_MEDIA_PREVIOUS: Int
Key code constant: Play Previous media key.
Value: 88
KEYCODE_MEDIA_RECORD
static val KEYCODE_MEDIA_RECORD: Int
Key code constant: Record media key.
Value: 130
KEYCODE_MEDIA_REWIND
static val KEYCODE_MEDIA_REWIND: Int
Key code constant: Rewind media key.
Value: 89
KEYCODE_MEDIA_SKIP_BACKWARD
static val KEYCODE_MEDIA_SKIP_BACKWARD: Int
Key code constant: Skip backward media key.
Value: 273
KEYCODE_MEDIA_SKIP_FORWARD
static val KEYCODE_MEDIA_SKIP_FORWARD: Int
Key code constant: Skip forward media key.
Value: 272
KEYCODE_MEDIA_STEP_BACKWARD
static val KEYCODE_MEDIA_STEP_BACKWARD: Int
Key code constant: Step backward media key. Steps media backward, one frame at a time.
Value: 275
KEYCODE_MEDIA_STEP_FORWARD
static val KEYCODE_MEDIA_STEP_FORWARD: Int
Key code constant: Step forward media key. Steps media forward, one frame at a time.
Value: 274
KEYCODE_MEDIA_STOP
static val KEYCODE_MEDIA_STOP: Int
Key code constant: Stop media key.
Value: 86
KEYCODE_MEDIA_TOP_MENU
static val KEYCODE_MEDIA_TOP_MENU: Int
Key code constant: Media Top Menu key. Goes to the top of media menu.
Value: 226
KEYCODE_MENU
static val KEYCODE_MENU: Int
Key code constant: Menu key.
Value: 82
KEYCODE_META_LEFT
static val KEYCODE_META_LEFT: Int
Key code constant: Left Meta modifier key.
Value: 117
KEYCODE_META_RIGHT
static val KEYCODE_META_RIGHT: Int
Key code constant: Right Meta modifier key.
Value: 118
KEYCODE_MOVE_END
static val KEYCODE_MOVE_END: Int
Key code constant: End Movement key. Used for scrolling or moving the cursor around to the end of a line or to the bottom of a list.
Value: 123
KEYCODE_MOVE_HOME
static val KEYCODE_MOVE_HOME: Int
Key code constant: Home Movement key. Used for scrolling or moving the cursor around to the start of a line or to the top of a list.
Value: 122
KEYCODE_MUHENKAN
static val KEYCODE_MUHENKAN: Int
Key code constant: Japanese non-conversion key.
Value: 213
KEYCODE_MUSIC
static val KEYCODE_MUSIC: Int
Key code constant: Music special function key. Used to launch a music player application.
Value: 209
KEYCODE_MUTE
static val KEYCODE_MUTE: Int
Key code constant: Mute key. Mute key for the microphone (unlike KEYCODE_VOLUME_MUTE
, which is the speaker mute key).
Value: 91
KEYCODE_NAVIGATE_IN
static val KEYCODE_NAVIGATE_IN: Int
Key code constant: Navigate in key. Activates the item that currently has focus or expands to the next level of a navigation hierarchy.
Value: 262
KEYCODE_NAVIGATE_NEXT
static val KEYCODE_NAVIGATE_NEXT: Int
Key code constant: Navigate to next key. Advances to the next item in an ordered collection of items.
Value: 261
KEYCODE_NAVIGATE_OUT
static val KEYCODE_NAVIGATE_OUT: Int
Key code constant: Navigate out key. Backs out one level of a navigation hierarchy or collapses the item that currently has focus.
Value: 263
KEYCODE_NAVIGATE_PREVIOUS
static val KEYCODE_NAVIGATE_PREVIOUS: Int
Key code constant: Navigate to previous key. Goes backward by one item in an ordered collection of items.
Value: 260
KEYCODE_NOTIFICATION
static val KEYCODE_NOTIFICATION: Int
Key code constant: Notification key.
Value: 83
KEYCODE_NUM
static val KEYCODE_NUM: Int
Key code constant: Number modifier key. Used to enter numeric symbols. This key is not Num Lock; it is more like KEYCODE_ALT_LEFT
and is interpreted as an ALT key by android.text.method.MetaKeyKeyListener
.
Value: 78
KEYCODE_NUMPAD_0
static val KEYCODE_NUMPAD_0: Int
Key code constant: Numeric keypad '0' key.
Value: 144
KEYCODE_NUMPAD_1
static val KEYCODE_NUMPAD_1: Int
Key code constant: Numeric keypad '1' key.
Value: 145
KEYCODE_NUMPAD_2
static val KEYCODE_NUMPAD_2: Int
Key code constant: Numeric keypad '2' key.
Value: 146
KEYCODE_NUMPAD_3
static val KEYCODE_NUMPAD_3: Int
Key code constant: Numeric keypad '3' key.
Value: 147
KEYCODE_NUMPAD_4
static val KEYCODE_NUMPAD_4: Int
Key code constant: Numeric keypad '4' key.
Value: 148
KEYCODE_NUMPAD_5
static val KEYCODE_NUMPAD_5: Int
Key code constant: Numeric keypad '5' key.
Value: 149
KEYCODE_NUMPAD_6
static val KEYCODE_NUMPAD_6: Int
Key code constant: Numeric keypad '6' key.
Value: 150
KEYCODE_NUMPAD_7
static val KEYCODE_NUMPAD_7: Int
Key code constant: Numeric keypad '7' key.
Value: 151
KEYCODE_NUMPAD_8
static val KEYCODE_NUMPAD_8: Int
Key code constant: Numeric keypad '8' key.
Value: 152
KEYCODE_NUMPAD_9
static val KEYCODE_NUMPAD_9: Int
Key code constant: Numeric keypad '9' key.
Value: 153
KEYCODE_NUMPAD_ADD
static val KEYCODE_NUMPAD_ADD: Int
Key code constant: Numeric keypad '+' key (for addition).
Value: 157
KEYCODE_NUMPAD_COMMA
static val KEYCODE_NUMPAD_COMMA: Int
Key code constant: Numeric keypad ',' key (for decimals or digit grouping).
Value: 159
KEYCODE_NUMPAD_DIVIDE
static val KEYCODE_NUMPAD_DIVIDE: Int
Key code constant: Numeric keypad '/' key (for division).
Value: 154
KEYCODE_NUMPAD_DOT
static val KEYCODE_NUMPAD_DOT: Int
Key code constant: Numeric keypad '.' key (for decimals or digit grouping).
Value: 158
KEYCODE_NUMPAD_ENTER
static val KEYCODE_NUMPAD_ENTER: Int
Key code constant: Numeric keypad Enter key.
Value: 160
KEYCODE_NUMPAD_EQUALS
static val KEYCODE_NUMPAD_EQUALS: Int
Key code constant: Numeric keypad '=' key.
Value: 161
KEYCODE_NUMPAD_LEFT_PAREN
static val KEYCODE_NUMPAD_LEFT_PAREN: Int
Key code constant: Numeric keypad '(' key.
Value: 162
KEYCODE_NUMPAD_MULTIPLY
static val KEYCODE_NUMPAD_MULTIPLY: Int
Key code constant: Numeric keypad '*' key (for multiplication).
Value: 155
KEYCODE_NUMPAD_RIGHT_PAREN
static val KEYCODE_NUMPAD_RIGHT_PAREN: Int
Key code constant: Numeric keypad ')' key.
Value: 163
KEYCODE_NUMPAD_SUBTRACT
static val KEYCODE_NUMPAD_SUBTRACT: Int
Key code constant: Numeric keypad '-' key (for subtraction).
Value: 156
KEYCODE_NUM_LOCK
static val KEYCODE_NUM_LOCK: Int
Key code constant: Num Lock key. This is the Num Lock key; it is different from KEYCODE_NUM
. This key alters the behavior of other keys on the numeric keypad.
Value: 143
KEYCODE_PAGE_DOWN
static val KEYCODE_PAGE_DOWN: Int
Key code constant: Page Down key.
Value: 93
KEYCODE_PAGE_UP
static val KEYCODE_PAGE_UP: Int
Key code constant: Page Up key.
Value: 92
KEYCODE_PAIRING
static val KEYCODE_PAIRING: Int
Key code constant: Pairing key. Initiates peripheral pairing mode. Useful for pairing remote control devices or game controllers, especially if no other input mode is available.
Value: 225
KEYCODE_PASTE
static val KEYCODE_PASTE: Int
Key code constant: Paste key.
Value: 279
KEYCODE_PERIOD
static val KEYCODE_PERIOD: Int
Key code constant: '.' key.
Value: 56
KEYCODE_PICTSYMBOLS
static val KEYCODE_PICTSYMBOLS: Int
Key code constant: Picture Symbols modifier key. Used to switch symbol sets (Emoji, Kao-moji).
Value: 94
KEYCODE_PLUS
static val KEYCODE_PLUS: Int
Key code constant: '+' key.
Value: 81
KEYCODE_POUND
static val KEYCODE_POUND: Int
Key code constant: '#' key.
Value: 18
KEYCODE_POWER
static val KEYCODE_POWER: Int
Key code constant: Power key.
Value: 26
KEYCODE_PROFILE_SWITCH
static val KEYCODE_PROFILE_SWITCH: Int
Key code constant: Used to switch current android.accounts.Account
that is consuming content. May be consumed by system to set account globally.
Value: 288
KEYCODE_PROG_BLUE
static val KEYCODE_PROG_BLUE: Int
Key code constant: Blue "programmable" key. On TV remotes, acts as a contextual/programmable key.
Value: 186
KEYCODE_PROG_GREEN
static val KEYCODE_PROG_GREEN: Int
Key code constant: Green "programmable" key. On TV remotes, actsas a contextual/programmable key.
Value: 184
KEYCODE_PROG_RED
static val KEYCODE_PROG_RED: Int
Key code constant: Red "programmable" key. On TV remotes, acts as a contextual/programmable key.
Value: 183
KEYCODE_PROG_YELLOW
static val KEYCODE_PROG_YELLOW: Int
Key code constant: Yellow "programmable" key. On TV remotes, acts as a contextual/programmable key.
Value: 185
KEYCODE_RECENT_APPS
static val KEYCODE_RECENT_APPS: Int
Key code constant: To open recent apps view (a.k.a. Overview). This key is handled by the framework and is never delivered to applications.
Value: 312
KEYCODE_REFRESH
static val KEYCODE_REFRESH: Int
Key code constant: Refresh key.
Value: 285
KEYCODE_RIGHT_BRACKET
static val KEYCODE_RIGHT_BRACKET: Int
Key code constant: ']' key.
Value: 72
KEYCODE_RO
static val KEYCODE_RO: Int
Key code constant: Japanese Ro key.
Value: 217
KEYCODE_SCREENSHOT
static val KEYCODE_SCREENSHOT: Int
Key code constant: To take a screenshot This key is fully handled by the framework and will not be sent to the foreground app, unlike KEYCODE_SYSRQ
which is sent to the app first and only if the app doesn't handle it, the framework handles it (to take a screenshot).
Value: 318
KEYCODE_SCROLL_LOCK
static val KEYCODE_SCROLL_LOCK: Int
Key code constant: Scroll Lock key.
Value: 116
KEYCODE_SEARCH
static val KEYCODE_SEARCH: Int
Key code constant: Search key.
Value: 84
KEYCODE_SEMICOLON
static val KEYCODE_SEMICOLON: Int
Key code constant: ';' key.
Value: 74
KEYCODE_SETTINGS
static val KEYCODE_SETTINGS: Int
Key code constant: Settings key. Starts the system settings activity.
Value: 176
KEYCODE_SHIFT_LEFT
static val KEYCODE_SHIFT_LEFT: Int
Key code constant: Left Shift modifier key.
Value: 59
KEYCODE_SHIFT_RIGHT
static val KEYCODE_SHIFT_RIGHT: Int
Key code constant: Right Shift modifier key.
Value: 60
KEYCODE_SLASH
static val KEYCODE_SLASH: Int
Key code constant: '/' key.
Value: 76
KEYCODE_SLEEP
static val KEYCODE_SLEEP: Int
Key code constant: Sleep key. Puts the device to sleep. Behaves somewhat like KEYCODE_POWER
but it has no effect if the device is already asleep.
Value: 223
KEYCODE_SOFT_LEFT
static val KEYCODE_SOFT_LEFT: Int
Key code constant: Soft Left key. Usually situated below the display on phones and used as a multi-function feature key for selecting a software defined function shown on the bottom left of the display.
Value: 1
KEYCODE_SOFT_RIGHT
static val KEYCODE_SOFT_RIGHT: Int
Key code constant: Soft Right key. Usually situated below the display on phones and used as a multi-function feature key for selecting a software defined function shown on the bottom right of the display.
Value: 2
KEYCODE_SOFT_SLEEP
static val KEYCODE_SOFT_SLEEP: Int
Key code constant: put device to sleep unless a wakelock is held.
Value: 276
KEYCODE_SPACE
static val KEYCODE_SPACE: Int
Key code constant: Space key.
Value: 62
KEYCODE_STAR
static val KEYCODE_STAR: Int
Key code constant: '*' key.
Value: 17
KEYCODE_STB_INPUT
static val KEYCODE_STB_INPUT: Int
Key code constant: Set-top-box input key. On TV remotes, switches the input mode on an external Set-top-box.
Value: 180
KEYCODE_STB_POWER
static val KEYCODE_STB_POWER: Int
Key code constant: Set-top-box power key. On TV remotes, toggles the power on an external Set-top-box.
Value: 179
KEYCODE_STEM_1
static val KEYCODE_STEM_1: Int
Key code constant: Generic stem key 1 for Wear
Value: 265
KEYCODE_STEM_2
static val KEYCODE_STEM_2: Int
Key code constant: Generic stem key 2 for Wear
Value: 266
KEYCODE_STEM_3
static val KEYCODE_STEM_3: Int
Key code constant: Generic stem key 3 for Wear
Value: 267
KEYCODE_STEM_PRIMARY
static val KEYCODE_STEM_PRIMARY: Int
Key code constant: Primary stem key for Wear Main power/reset button on watch.
Value: 264
KEYCODE_STYLUS_BUTTON_PRIMARY
static val KEYCODE_STYLUS_BUTTON_PRIMARY: Int
Key code constant: The primary button on the barrel of a stylus. This is usually the button closest to the tip of the stylus.
Value: 308
KEYCODE_STYLUS_BUTTON_SECONDARY
static val KEYCODE_STYLUS_BUTTON_SECONDARY: Int
Key code constant: The secondary button on the barrel of a stylus. This is usually the second button from the tip of the stylus.
Value: 309
KEYCODE_STYLUS_BUTTON_TAIL
static val KEYCODE_STYLUS_BUTTON_TAIL: Int
Key code constant: A button on the tail end of a stylus. The use of this button does not usually correspond to the function of an eraser.
Value: 311
KEYCODE_STYLUS_BUTTON_TERTIARY
static val KEYCODE_STYLUS_BUTTON_TERTIARY: Int
Key code constant: The tertiary button on the barrel of a stylus. This is usually the third button from the tip of the stylus.
Value: 310
KEYCODE_SWITCH_CHARSET
static val KEYCODE_SWITCH_CHARSET: Int
Key code constant: Switch Charset modifier key. Used to switch character sets (Kanji, Katakana).
Value: 95
KEYCODE_SYM
static val KEYCODE_SYM: Int
Key code constant: Symbol modifier key. Used to enter alternate symbols.
Value: 63
KEYCODE_SYSRQ
static val KEYCODE_SYSRQ: Int
Key code constant: System Request / Print Screen key. This key is sent to the app first and only if the app doesn't handle it, the framework handles it (to take a screenshot), unlike KEYCODE_TAKE_SCREENSHOT
which is fully handled by the framework.
Value: 120
KEYCODE_SYSTEM_NAVIGATION_DOWN
static val KEYCODE_SYSTEM_NAVIGATION_DOWN: Int
Key code constant: Consumed by the system for navigation down
Value: 281
KEYCODE_SYSTEM_NAVIGATION_LEFT
static val KEYCODE_SYSTEM_NAVIGATION_LEFT: Int
Key code constant: Consumed by the system for navigation left
Value: 282
KEYCODE_SYSTEM_NAVIGATION_RIGHT
static val KEYCODE_SYSTEM_NAVIGATION_RIGHT: Int
Key code constant: Consumed by the system for navigation right
Value: 283
KEYCODE_SYSTEM_NAVIGATION_UP
static val KEYCODE_SYSTEM_NAVIGATION_UP: Int
Key code constant: Consumed by the system for navigation up
Value: 280
KEYCODE_THUMBS_DOWN
static val KEYCODE_THUMBS_DOWN: Int
Key code constant: Thumbs down key. Apps can use this to let user downvote content.
Value: 287
KEYCODE_THUMBS_UP
static val KEYCODE_THUMBS_UP: Int
Key code constant: Thumbs up key. Apps can use this to let user upvote content.
Value: 286
KEYCODE_TV
static val KEYCODE_TV: Int
Key code constant: TV key. On TV remotes, switches to viewing live TV.
Value: 170
KEYCODE_TV_ANTENNA_CABLE
static val KEYCODE_TV_ANTENNA_CABLE: Int
Key code constant: Antenna/Cable key. Toggles broadcast input source between antenna and cable.
Value: 242
KEYCODE_TV_AUDIO_DESCRIPTION
static val KEYCODE_TV_AUDIO_DESCRIPTION: Int
Key code constant: Audio description key. Toggles audio description off / on.
Value: 252
KEYCODE_TV_AUDIO_DESCRIPTION_MIX_DOWN
static val KEYCODE_TV_AUDIO_DESCRIPTION_MIX_DOWN: Int
Key code constant: Audio description mixing volume down key. Lessen audio description volume as compared with normal audio volume.
Value: 254
KEYCODE_TV_AUDIO_DESCRIPTION_MIX_UP
static val KEYCODE_TV_AUDIO_DESCRIPTION_MIX_UP: Int
Key code constant: Audio description mixing volume up key. Louden audio description volume as compared with normal audio volume.
Value: 253
KEYCODE_TV_CONTENTS_MENU
static val KEYCODE_TV_CONTENTS_MENU: Int
Key code constant: Contents menu key. Goes to the title list. Corresponds to Contents Menu (0x0B) of CEC User Control Code
Value: 256
KEYCODE_TV_DATA_SERVICE
static val KEYCODE_TV_DATA_SERVICE: Int
Key code constant: TV data service key. Displays data services like weather, sports.
Value: 230
KEYCODE_TV_INPUT
static val KEYCODE_TV_INPUT: Int
Key code constant: TV input key. On TV remotes, switches the input on a television screen.
Value: 178
KEYCODE_TV_INPUT_COMPONENT_1
static val KEYCODE_TV_INPUT_COMPONENT_1: Int
Key code constant: Component #1 key. Switches to component video input #1.
Value: 249
KEYCODE_TV_INPUT_COMPONENT_2
static val KEYCODE_TV_INPUT_COMPONENT_2: Int
Key code constant: Component #2 key. Switches to component video input #2.
Value: 250
KEYCODE_TV_INPUT_COMPOSITE_1
static val KEYCODE_TV_INPUT_COMPOSITE_1: Int
Key code constant: Composite #1 key. Switches to composite video input #1.
Value: 247
KEYCODE_TV_INPUT_COMPOSITE_2
static val KEYCODE_TV_INPUT_COMPOSITE_2: Int
Key code constant: Composite #2 key. Switches to composite video input #2.
Value: 248
KEYCODE_TV_INPUT_HDMI_1
static val KEYCODE_TV_INPUT_HDMI_1: Int
Key code constant: HDMI #1 key. Switches to HDMI input #1.
Value: 243
KEYCODE_TV_INPUT_HDMI_2
static val KEYCODE_TV_INPUT_HDMI_2: Int
Key code constant: HDMI #2 key. Switches to HDMI input #2.
Value: 244
KEYCODE_TV_INPUT_HDMI_3
static val KEYCODE_TV_INPUT_HDMI_3: Int
Key code constant: HDMI #3 key. Switches to HDMI input #3.
Value: 245
KEYCODE_TV_INPUT_HDMI_4
static val KEYCODE_TV_INPUT_HDMI_4: Int
Key code constant: HDMI #4 key. Switches to HDMI input #4.
Value: 246
KEYCODE_TV_INPUT_VGA_1
static val KEYCODE_TV_INPUT_VGA_1: Int
Key code constant: VGA #1 key. Switches to VGA (analog RGB) input #1.
Value: 251
KEYCODE_TV_MEDIA_CONTEXT_MENU
static val KEYCODE_TV_MEDIA_CONTEXT_MENU: Int
Key code constant: Media context menu key. Goes to the context menu of media contents. Corresponds to Media Context-sensitive Menu (0x11) of CEC User Control Code.
Value: 257
KEYCODE_TV_NETWORK
static val KEYCODE_TV_NETWORK: Int
Key code constant: Toggle Network key. Toggles selecting broacast services.
Value: 241
KEYCODE_TV_NUMBER_ENTRY
static val KEYCODE_TV_NUMBER_ENTRY: Int
Key code constant: Number entry key. Initiates to enter multi-digit channel nubmber when each digit key is assigned for selecting separate channel. Corresponds to Number Entry Mode (0x1D) of CEC User Control Code.
Value: 234
KEYCODE_TV_POWER
static val KEYCODE_TV_POWER: Int
Key code constant: TV power key. On HDMI TV panel devices and Android TV devices that don't support HDMI, toggles the power state of the device. On HDMI source devices, toggles the power state of the HDMI-connected TV via HDMI-CEC and makes the source device follow this power state.
Value: 177
KEYCODE_TV_RADIO_SERVICE
static val KEYCODE_TV_RADIO_SERVICE: Int
Key code constant: Radio key. Toggles TV service / Radio service.
Value: 232
KEYCODE_TV_SATELLITE
static val KEYCODE_TV_SATELLITE: Int
Key code constant: Satellite key. Switches to digital satellite broadcast service.
Value: 237
KEYCODE_TV_SATELLITE_BS
static val KEYCODE_TV_SATELLITE_BS: Int
Key code constant: BS key. Switches to BS digital satellite broadcasting service available in Japan.
Value: 238
KEYCODE_TV_SATELLITE_CS
static val KEYCODE_TV_SATELLITE_CS: Int
Key code constant: CS key. Switches to CS digital satellite broadcasting service available in Japan.
Value: 239
KEYCODE_TV_SATELLITE_SERVICE
static val KEYCODE_TV_SATELLITE_SERVICE: Int
Key code constant: BS/CS key. Toggles between BS and CS digital satellite services.
Value: 240
KEYCODE_TV_TELETEXT
static val KEYCODE_TV_TELETEXT: Int
Key code constant: Teletext key. Displays Teletext service.
Value: 233
KEYCODE_TV_TERRESTRIAL_ANALOG
static val KEYCODE_TV_TERRESTRIAL_ANALOG: Int
Key code constant: Analog Terrestrial key. Switches to analog terrestrial broadcast service.
Value: 235
KEYCODE_TV_TERRESTRIAL_DIGITAL
static val KEYCODE_TV_TERRESTRIAL_DIGITAL: Int
Key code constant: Digital Terrestrial key. Switches to digital terrestrial broadcast service.
Value: 236
KEYCODE_TV_TIMER_PROGRAMMING
static val KEYCODE_TV_TIMER_PROGRAMMING: Int
Key code constant: Timer programming key. Goes to the timer recording menu. Corresponds to Timer Programming (0x54) of CEC User Control Code.
Value: 258
KEYCODE_TV_ZOOM_MODE
static val KEYCODE_TV_ZOOM_MODE: Int
Key code constant: Zoom mode key. Changes Zoom mode (Normal, Full, Zoom, Wide-zoom, etc.)
Value: 255
KEYCODE_UNKNOWN
static val KEYCODE_UNKNOWN: Int
Key code constant: Unknown key code.
Value: 0
KEYCODE_VIDEO_APP_1
static val KEYCODE_VIDEO_APP_1: Int
Key code constant: Video Application key #1.
Value: 289
KEYCODE_VIDEO_APP_2
static val KEYCODE_VIDEO_APP_2: Int
Key code constant: Video Application key #2.
Value: 290
KEYCODE_VIDEO_APP_3
static val KEYCODE_VIDEO_APP_3: Int
Key code constant: Video Application key #3.
Value: 291
KEYCODE_VIDEO_APP_4
static val KEYCODE_VIDEO_APP_4: Int
Key code constant: Video Application key #4.
Value: 292
KEYCODE_VIDEO_APP_5
static val KEYCODE_VIDEO_APP_5: Int
Key code constant: Video Application key #5.
Value: 293
KEYCODE_VIDEO_APP_6
static val KEYCODE_VIDEO_APP_6: Int
Key code constant: Video Application key #6.
Value: 294
KEYCODE_VIDEO_APP_7
static val KEYCODE_VIDEO_APP_7: Int
Key code constant: Video Application key #7.
Value: 295
KEYCODE_VIDEO_APP_8
static val KEYCODE_VIDEO_APP_8: Int
Key code constant: Video Application key #8.
Value: 296
KEYCODE_VOICE_ASSIST
static val KEYCODE_VOICE_ASSIST: Int
Key code constant: Voice Assist key. Launches the global voice assist activity. Not delivered to applications.
Value: 231
KEYCODE_VOLUME_DOWN
static val KEYCODE_VOLUME_DOWN: Int
Key code constant: Volume Down key. Adjusts the speaker volume down.
Value: 25
KEYCODE_VOLUME_MUTE
static val KEYCODE_VOLUME_MUTE: Int
Key code constant: Volume Mute key. Mute key for speaker (unlike KEYCODE_MUTE
, which is the mute key for the microphone). This key should normally be implemented as a toggle such that the first press mutes the speaker and the second press restores the original volume.
Value: 164
KEYCODE_VOLUME_UP
static val KEYCODE_VOLUME_UP: Int
Key code constant: Volume Up key. Adjusts the speaker volume up.
Value: 24
KEYCODE_WAKEUP
static val KEYCODE_WAKEUP: Int
Key code constant: Wakeup key. Wakes up the device. Behaves somewhat like KEYCODE_POWER
but it has no effect if the device is already awake.
Value: 224
KEYCODE_WINDOW
static val KEYCODE_WINDOW: Int
Key code constant: Window key. On TV remotes, toggles picture-in-picture mode or other windowing functions. On Android Wear devices, triggers a display offset.
Value: 171
KEYCODE_YEN
static val KEYCODE_YEN: Int
Key code constant: Japanese Yen key.
Value: 216
KEYCODE_ZENKAKU_HANKAKU
static val KEYCODE_ZENKAKU_HANKAKU: Int
Key code constant: Japanese full-width / half-width key.
Value: 211
KEYCODE_ZOOM_IN
static val KEYCODE_ZOOM_IN: Int
Key code constant: Zoom in key.
Value: 168
KEYCODE_ZOOM_OUT
static val KEYCODE_ZOOM_OUT: Int
Key code constant: Zoom out key.
Value: 169
MAX_KEYCODE
static valMAX_KEYCODE: Int
Deprecated: There are now more than MAX_KEYCODE keycodes. Use getMaxKeyCode()
instead.
Value: 84
META_ALT_LEFT_ON
static val META_ALT_LEFT_ON: Int
This mask is used to check whether the left ALT meta key is pressed.
Value: 16
META_ALT_MASK
static val META_ALT_MASK: Int
This mask is a combination of META_ALT_ON
, META_ALT_LEFT_ON
and META_ALT_RIGHT_ON
.
Value: 50
META_ALT_ON
static val META_ALT_ON: Int
This mask is used to check whether one of the ALT meta keys is pressed.
Value: 2
META_ALT_RIGHT_ON
static val META_ALT_RIGHT_ON: Int
This mask is used to check whether the right the ALT meta key is pressed.
Value: 32
META_CAPS_LOCK_ON
static val META_CAPS_LOCK_ON: Int
This mask is used to check whether the CAPS LOCK meta key is on.
Value: 1048576
META_CTRL_LEFT_ON
static val META_CTRL_LEFT_ON: Int
This mask is used to check whether the left CTRL meta key is pressed.
Value: 8192
META_CTRL_MASK
static val META_CTRL_MASK: Int
This mask is a combination of META_CTRL_ON
, META_CTRL_LEFT_ON
and META_CTRL_RIGHT_ON
.
Value: 28672
META_CTRL_ON
static val META_CTRL_ON: Int
This mask is used to check whether one of the CTRL meta keys is pressed.
Value: 4096
META_CTRL_RIGHT_ON
static val META_CTRL_RIGHT_ON: Int
This mask is used to check whether the right CTRL meta key is pressed.
Value: 16384
META_FUNCTION_ON
static val META_FUNCTION_ON: Int
This mask is used to check whether the FUNCTION meta key is pressed.
Value: 8
See Also
META_META_LEFT_ON
static val META_META_LEFT_ON: Int
This mask is used to check whether the left META meta key is pressed.
Value: 131072
META_META_MASK
static val META_META_MASK: Int
This mask is a combination of META_META_ON
, META_META_LEFT_ON
and META_META_RIGHT_ON
.
Value: 458752
META_META_ON
static val META_META_ON: Int
This mask is used to check whether one of the META meta keys is pressed.
Value: 65536
META_META_RIGHT_ON
static val META_META_RIGHT_ON: Int
This mask is used to check whether the right META meta key is pressed.
Value: 262144
META_NUM_LOCK_ON
static val META_NUM_LOCK_ON: Int
This mask is used to check whether the NUM LOCK meta key is on.
Value: 2097152
META_SCROLL_LOCK_ON
static val META_SCROLL_LOCK_ON: Int
This mask is used to check whether the SCROLL LOCK meta key is on.
Value: 4194304
META_SHIFT_LEFT_ON
static val META_SHIFT_LEFT_ON: Int
This mask is used to check whether the left SHIFT meta key is pressed.
Value: 64
META_SHIFT_MASK
static val META_SHIFT_MASK: Int
This mask is a combination of META_SHIFT_ON
, META_SHIFT_LEFT_ON
and META_SHIFT_RIGHT_ON
.
Value: 193
META_SHIFT_ON
static val META_SHIFT_ON: Int
This mask is used to check whether one of the SHIFT meta keys is pressed.
Value: 1
META_SHIFT_RIGHT_ON
static val META_SHIFT_RIGHT_ON: Int
This mask is used to check whether the right SHIFT meta key is pressed.
Value: 128
META_SYM_ON
static val META_SYM_ON: Int
This mask is used to check whether the SYM meta key is pressed.
Value: 4
See Also
Public constructors
KeyEvent
KeyEvent(origEvent: KeyEvent!)
Make an exact copy of an existing key event.
KeyEvent
KeyEvent(
origEvent: KeyEvent!,
eventTime: Long,
newRepeat: Int)
Deprecated: Use changeTimeRepeat(android.view.KeyEvent,long,int)
instead.
Copy an existing key event, modifying its time and repeat count.
Parameters | |
---|---|
origEvent |
KeyEvent!: The existing event to be copied. |
eventTime |
Long: The new event time (in android.os.SystemClock#uptimeMillis ) of the event. |
newRepeat |
Int: The new repeat count of the event. |
KeyEvent
KeyEvent(
action: Int,
code: Int)
Create a new key event.
Parameters | |
---|---|
action |
Int: Action code: either ACTION_DOWN , ACTION_UP , or ACTION_MULTIPLE . |
code |
Int: The key code. |
KeyEvent
KeyEvent(
time: Long,
characters: String!,
deviceId: Int,
flags: Int)
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.
Parameters | |
---|---|
time |
Long: The time (in android.os.SystemClock#uptimeMillis ) at which this event occured. |
characters |
String!: The string of characters. |
deviceId |
Int: The device ID that generated the key event. |
flags |
Int: The flags for this key event |
KeyEvent
KeyEvent(
downTime: Long,
eventTime: Long,
action: Int,
code: Int,
repeat: Int)
Create a new key event.
Parameters | |
---|---|
downTime |
Long: The time (in android.os.SystemClock#uptimeMillis ) at which this key code originally went down. |
eventTime |
Long: The time (in android.os.SystemClock#uptimeMillis ) at which this event happened. |
action |
Int: Action code: either ACTION_DOWN , ACTION_UP , or ACTION_MULTIPLE . |
code |
Int: The key code. |
repeat |
Int: A repeat count for down events (> 0 if this is after the initial down) or event count for multiple events. |
KeyEvent
KeyEvent(
downTime: Long,
eventTime: Long,
action: Int,
code: Int,
repeat: Int,
metaState: Int)
Create a new key event.
Parameters | |
---|---|
downTime |
Long: The time (in android.os.SystemClock#uptimeMillis ) at which this key code originally went down. |
eventTime |
Long: The time (in android.os.SystemClock#uptimeMillis ) at which this event happened. |
action |
Int: Action code: either ACTION_DOWN , ACTION_UP , or ACTION_MULTIPLE . |
code |
Int: The key code. |
repeat |
Int: A repeat count for down events (> 0 if this is after the initial down) or event count for multiple events. |
metaState |
Int: Flags indicating which meta keys are currently pressed. |
KeyEvent
KeyEvent(
downTime: Long,
eventTime: Long,
action: Int,
code: Int,
repeat: Int,
metaState: Int,
deviceId: Int,
scancode: Int)
Create a new key event.
Parameters | |
---|---|
downTime |
Long: The time (in android.os.SystemClock#uptimeMillis ) at which this key code originally went down. |
eventTime |
Long: The time (in android.os.SystemClock#uptimeMillis ) at which this event happened. |
action |
Int: Action code: either ACTION_DOWN , ACTION_UP , or ACTION_MULTIPLE . |
code |
Int: The key code. |
repeat |
Int: A repeat count for down events (> 0 if this is after the initial down) or event count for multiple events. |
metaState |
Int: Flags indicating which meta keys are currently pressed. |
deviceId |
Int: The device ID that generated the key event. |
scancode |
Int: Raw device scan code of the event. |
KeyEvent
KeyEvent(
downTime: Long,
eventTime: Long,
action: Int,
code: Int,
repeat: Int,
metaState: Int,
deviceId: Int,
scancode: Int,
flags: Int)
Create a new key event.
Parameters | |
---|---|
downTime |
Long: The time (in android.os.SystemClock#uptimeMillis ) at which this key code originally went down. |
eventTime |
Long: The time (in android.os.SystemClock#uptimeMillis ) at which this event happened. |
action |
Int: Action code: either ACTION_DOWN , ACTION_UP , or ACTION_MULTIPLE . |
code |
Int: The key code. |
repeat |
Int: A repeat count for down events (> 0 if this is after the initial down) or event count for multiple events. |
metaState |
Int: Flags indicating which meta keys are currently pressed. |
deviceId |
Int: The device ID that generated the key event. |
scancode |
Int: Raw device scan code of the event. |
flags |
Int: The flags for this key event |
KeyEvent
KeyEvent(
downTime: Long,
eventTime: Long,
action: Int,
code: Int,
repeat: Int,
metaState: Int,
deviceId: Int,
scancode: Int,
flags: Int,
source: Int)
Create a new key event.
Parameters | |
---|---|
downTime |
Long: The time (in android.os.SystemClock#uptimeMillis ) at which this key code originally went down. |
eventTime |
Long: The time (in android.os.SystemClock#uptimeMillis ) at which this event happened. |
action |
Int: Action code: either ACTION_DOWN , ACTION_UP , or ACTION_MULTIPLE . |
code |
Int: The key code. |
repeat |
Int: A repeat count for down events (> 0 if this is after the initial down) or event count for multiple events. |
metaState |
Int: Flags indicating which meta keys are currently pressed. |
deviceId |
Int: The device ID that generated the key event. |
scancode |
Int: Raw device scan code of the event. |
flags |
Int: The flags for this key event |
source |
Int: The input source such as InputDevice.SOURCE_KEYBOARD . |
Public methods
changeAction
open static fun changeAction(
event: KeyEvent!,
action: Int
): KeyEvent!
Create a new key event that is the same as the given one, but whose action is replaced with the given value.
Parameters | |
---|---|
event |
KeyEvent!: The existing event to be copied. This is not modified. |
action |
Int: The new action code of the event. |
changeFlags
open static fun changeFlags(
event: KeyEvent!,
flags: Int
): KeyEvent!
Create a new key event that is the same as the given one, but whose flags are replaced with the given value.
Parameters | |
---|---|
event |
KeyEvent!: The existing event to be copied. This is not modified. |
flags |
Int: The new flags constant. |
changeTimeRepeat
open static fun changeTimeRepeat(
event: KeyEvent!,
eventTime: Long,
newRepeat: Int
): KeyEvent!
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.
Parameters | |
---|---|
event |
KeyEvent!: The existing event to be copied. This is not modified. |
eventTime |
Long: The new event time (in android.os.SystemClock#uptimeMillis ) of the event. |
newRepeat |
Int: The new repeat count of the event. |
changeTimeRepeat
open static fun changeTimeRepeat(
event: KeyEvent!,
eventTime: Long,
newRepeat: Int,
newFlags: Int
): KeyEvent!
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.
Parameters | |
---|---|
event |
KeyEvent!: The existing event to be copied. This is not modified. |
eventTime |
Long: The new event time (in android.os.SystemClock#uptimeMillis ) of the event. |
newRepeat |
Int: The new repeat count of the event. |
newFlags |
Int: New flags for the event, replacing the entire value in the original event. |
dispatch
fundispatch(receiver: KeyEvent.Callback!): Boolean
Deprecated: Use dispatch(android.view.KeyEvent.Callback,android.view.KeyEvent.DispatcherState,java.lang.Object)
instead.
dispatch
fun dispatch(
receiver: KeyEvent.Callback!,
state: KeyEvent.DispatcherState!,
target: Any!
): Boolean
Deliver this key event to a Callback
interface. If this is an ACTION_MULTIPLE event and it is not handled, then an attempt will be made to deliver a single normal event.
Parameters | |
---|---|
receiver |
KeyEvent.Callback!: The Callback that will be given the event. |
state |
KeyEvent.DispatcherState!: State information retained across events. |
target |
Any!: The target of the dispatch, for use in tracking. |
Return | |
---|---|
Boolean |
The return value from the Callback method that was called. |
getAction
fun getAction(): Int
Retrieve the action of this key event. May be either ACTION_DOWN
, ACTION_UP
, or ACTION_MULTIPLE
.
Return | |
---|---|
Int |
The event action: ACTION_DOWN, ACTION_UP, or ACTION_MULTIPLE. |
getCharacters
fungetCharacters(): String!
Deprecated: no longer used by the input system.
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. In all other cases it is null.
Return | |
---|---|
String! |
Returns a String of 1 or more characters associated with the event. |
getDeadChar
open static fun getDeadChar(
accent: Int,
c: Int
): Int
Get the character that is produced by putting accent on the character c. For example, getDeadChar('`', 'e') returns è.
getDeviceId
fun getDeviceId(): Int
Gets the id for the device that this event came from. An id of zero indicates that the event didn't come from a physical device and maps to the default keymap. The other numbers are arbitrary and you shouldn't depend on the values.
Return | |
---|---|
Int |
The device id. |
getDisplayLabel
open fun getDisplayLabel(): Char
Gets the primary character for this key. In other words, the label that is physically printed on it.
Return | |
---|---|
Char |
The display label character, or 0 if none (eg. for non-printing keys). |
getDownTime
fun getDownTime(): Long
Retrieve the time of the most recent key down event, in the android.os.SystemClock#uptimeMillis
time base. If this is a down event, this will be the same as getEventTime()
. Note that when chording keys, this value is the down time of the most recently pressed key, which may not be the same physical key of this event.
Return | |
---|---|
Long |
Returns the most recent key down time, in the android.os.SystemClock#uptimeMillis time base |
getEventTime
fun getEventTime(): Long
Retrieve the time this event occurred, in the android.os.SystemClock#uptimeMillis
time base.
Return | |
---|---|
Long |
Returns the time this event occurred, in the android.os.SystemClock#uptimeMillis time base. |
getKeyCharacterMap
fun getKeyCharacterMap(): KeyCharacterMap!
Gets the KeyCharacterMap
associated with the keyboard device.
Return | |
---|---|
KeyCharacterMap! |
The associated key character map. |
Exceptions | |
---|---|
|
KeyCharacterMap.UnavailableException if the key character map could not be loaded because it was malformed or the default key character map is missing from the system. |
See Also
getKeyCode
fun getKeyCode(): Int
Retrieve the key code of the key event. This is the physical key that was pressed, not the Unicode character.
Return | |
---|---|
Int |
The key code of the event. |
getKeyData
open fungetKeyData(results: KeyCharacterMap.KeyData!): Boolean
Deprecated: instead use getDisplayLabel()
, getNumber()
or getUnicodeChar(int)
.
Get the character conversion data for a given key code.
Parameters | |
---|---|
results |
KeyCharacterMap.KeyData!: A KeyCharacterMap.KeyData instance that will be filled with the results. |
Return | |
---|---|
Boolean |
True if the key was mapped. If the key was not mapped, results is not modified. |
getMatch
open fun getMatch(chars: CharArray!): Char
Gets the first character in the character array that can be generated by the specified key code.
This is a convenience function that returns the same value as getMatch(chars, 0)
.
Parameters | |
---|---|
chars |
CharArray!: The array of matching characters to consider. |
Return | |
---|---|
Char |
The matching associated character, or 0 if none. |
getMatch
open fun getMatch(
chars: CharArray!,
metaState: Int
): Char
Gets the first character in the character array that can be generated by the specified key code. If there are multiple choices, prefers the one that would be generated with the specified meta key modifier state.
Parameters | |
---|---|
chars |
CharArray!: The array of matching characters to consider. |
metaState |
Int: The preferred meta key modifier state. |
Return | |
---|---|
Char |
The matching associated character, or 0 if none. |
getMaxKeyCode
open static fun getMaxKeyCode(): Int
Returns the maximum keycode.
getMetaState
fun getMetaState(): Int
Returns the state of the meta keys.
Return | |
---|---|
Int |
an integer in which each bit set to 1 represents a pressed meta key |
See Also
#isAltPressed()
#isShiftPressed()
#isSymPressed()
#isCtrlPressed()
#isMetaPressed()
#isFunctionPressed()
#isCapsLockOn()
#isNumLockOn()
#isScrollLockOn()
#META_ALT_ON
#META_ALT_LEFT_ON
#META_ALT_RIGHT_ON
#META_SHIFT_ON
#META_SHIFT_LEFT_ON
#META_SHIFT_RIGHT_ON
#META_SYM_ON
#META_FUNCTION_ON
#META_CTRL_ON
#META_CTRL_LEFT_ON
#META_CTRL_RIGHT_ON
#META_META_ON
#META_META_LEFT_ON
#META_META_RIGHT_ON
#META_CAPS_LOCK_ON
#META_NUM_LOCK_ON
#META_SCROLL_LOCK_ON
#getModifiers
getModifierMetaStateMask
open static fun getModifierMetaStateMask(): Int
Gets a mask that includes all valid modifier key meta state bits.
For the purposes of this function, KEYCODE_CAPS_LOCK
, KEYCODE_SCROLL_LOCK
, and KEYCODE_NUM_LOCK
are not considered modifier keys. Consequently, the mask specifically excludes META_CAPS_LOCK_ON
, META_SCROLL_LOCK_ON
and META_NUM_LOCK_ON
.
Return | |
---|---|
Int |
The modifier meta state mask which is a combination of META_SHIFT_ON , META_SHIFT_LEFT_ON , META_SHIFT_RIGHT_ON , META_ALT_ON , META_ALT_LEFT_ON , META_ALT_RIGHT_ON , META_CTRL_ON , META_CTRL_LEFT_ON , META_CTRL_RIGHT_ON , META_META_ON , META_META_LEFT_ON , META_META_RIGHT_ON , META_SYM_ON , META_FUNCTION_ON . |
getModifiers
fun getModifiers(): Int
Returns the state of the modifier keys.
For the purposes of this function, KEYCODE_CAPS_LOCK
, KEYCODE_SCROLL_LOCK
, and KEYCODE_NUM_LOCK
are not considered modifier keys. Consequently, this function specifically masks out META_CAPS_LOCK_ON
, META_SCROLL_LOCK_ON
and META_NUM_LOCK_ON
.
The value returned consists of the meta state (from getMetaState
) normalized using normalizeMetaState(int)
and then masked with getModifierMetaStateMask
so that only valid modifier bits are retained.
Return | |
---|---|
Int |
An integer in which each bit set to 1 represents a pressed modifier key. |
See Also
getNumber
open fun getNumber(): Char
Gets the number or symbol associated with the key.
The character value is returned, not the numeric value. If the key is not a number, but is a symbol, the symbol is retuned.
This method is intended to to support dial pads and other numeric or symbolic entry on keyboards where certain keys serve dual function as alphabetic and symbolic keys. This method returns the number or symbol associated with the key independent of whether the user has pressed the required modifier.
For example, on one particular keyboard the keys on the top QWERTY row generate numbers when ALT is pressed such that ALT-Q maps to '1'. So for that keyboard when getNumber
is called with KeyEvent.KEYCODE_Q
it returns '1' so that the user can type numbers without pressing ALT when it makes sense.
Return | |
---|---|
Char |
The associated numeric or symbolic character, or 0 if none. |
getRepeatCount
fun getRepeatCount(): Int
Retrieve the repeat count of the event. For key down events, this is the number of times the key has repeated with the first down starting at 0 and counting up from there. For key up events, this is always equal to zero. For multiple key events, this is the number of down/up pairs that have occurred.
Return | |
---|---|
Int |
The number of times the key has repeated. |
getScanCode
fun getScanCode(): Int
Retrieve the hardware key id of this key event. These values are not reliable and vary from device to device. {@more} Mostly this is here for debugging purposes.
getSource
fun getSource(): Int
Gets the source of the event.
Return | |
---|---|
Int |
The event source or InputDevice.SOURCE_UNKNOWN if unknown. |
getUnicodeChar
open fun getUnicodeChar(): Int
Gets the Unicode character generated by the specified key and meta key state combination.
Returns the Unicode character that the specified key would produce when the specified meta bits (see MetaKeyKeyListener
) were active.
Returns 0 if the key is not one that is used to type Unicode characters.
If the return value has bit KeyCharacterMap.COMBINING_ACCENT
set, the key is a "dead key" that should be combined with another to actually produce a character -- see KeyCharacterMap.getDeadChar
-- after masking with KeyCharacterMap.COMBINING_ACCENT_MASK
.
Return | |
---|---|
Int |
The associated character or combining accent, or 0 if none. |
getUnicodeChar
open fun getUnicodeChar(metaState: Int): Int
Gets the Unicode character generated by the specified key and meta key state combination.
Returns the Unicode character that the specified key would produce when the specified meta bits (see MetaKeyKeyListener
) were active.
Returns 0 if the key is not one that is used to type Unicode characters.
If the return value has bit KeyCharacterMap.COMBINING_ACCENT
set, the key is a "dead key" that should be combined with another to actually produce a character -- see KeyCharacterMap.getDeadChar
-- after masking with KeyCharacterMap.COMBINING_ACCENT_MASK
.
Parameters | |
---|---|
metaState |
Int: The meta key modifier state. |
Return | |
---|---|
Int |
The associated character or combining accent, or 0 if none. |
hasModifiers
fun hasModifiers(modifiers: Int): Boolean
Returns true if only the specified modifiers keys are pressed. Returns false if a different combination of modifier keys are pressed.
For the purposes of this function, KEYCODE_CAPS_LOCK
, KEYCODE_SCROLL_LOCK
, and KEYCODE_NUM_LOCK
are not considered modifier keys. Consequently, this function ignores META_CAPS_LOCK_ON
, META_SCROLL_LOCK_ON
and META_NUM_LOCK_ON
.
If the specified modifier mask includes directional modifiers, such as META_SHIFT_LEFT_ON
, then this method ensures that the modifier is pressed on that side. If the specified modifier mask includes non-directional modifiers, such as META_SHIFT_ON
, then this method ensures that the modifier is pressed on either side. If the specified modifier mask includes both directional and non-directional modifiers for the same type of key, such as META_SHIFT_ON
and META_SHIFT_LEFT_ON
, then this method throws an illegal argument exception.
Parameters | |
---|---|
modifiers |
Int: The meta state of the modifier keys to check. May be a combination of modifier meta states as defined by getModifierMetaStateMask() . May be 0 to ensure that no modifier keys are pressed. |
Return | |
---|---|
Boolean |
True if only the specified modifier keys are pressed. |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
if the modifiers parameter contains invalid modifiers |
See Also
hasNoModifiers
fun hasNoModifiers(): Boolean
Returns true if no modifier keys are pressed.
For the purposes of this function, KEYCODE_CAPS_LOCK
, KEYCODE_SCROLL_LOCK
, and KEYCODE_NUM_LOCK
are not considered modifier keys. Consequently, this function ignores META_CAPS_LOCK_ON
, META_SCROLL_LOCK_ON
and META_NUM_LOCK_ON
.
The meta state is normalized prior to comparison using normalizeMetaState(int)
.
Return | |
---|---|
Boolean |
True if no modifier keys are pressed. |
See Also
isAltPressed
fun isAltPressed(): Boolean
Returns the pressed state of the ALT meta key.
Return | |
---|---|
Boolean |
true if the ALT key is pressed, false otherwise |
isCanceled
fun isCanceled(): Boolean
For ACTION_UP
events, indicates that the event has been canceled as per FLAG_CANCELED
.
isCapsLockOn
fun isCapsLockOn(): Boolean
Returns the locked state of the CAPS LOCK meta key.
Return | |
---|---|
Boolean |
true if the CAPS LOCK key is on, false otherwise |
See Also
isCtrlPressed
fun isCtrlPressed(): Boolean
Returns the pressed state of the CTRL meta key.
Return | |
---|---|
Boolean |
true if the CTRL key is pressed, false otherwise |
isFunctionPressed
fun isFunctionPressed(): Boolean
Returns the pressed state of the FUNCTION meta key.
Return | |
---|---|
Boolean |
true if the FUNCTION key is pressed, false otherwise |
See Also
isGamepadButton
static fun isGamepadButton(keyCode: Int): Boolean
Returns true if the specified keycode is a gamepad button.
Return | |
---|---|
Boolean |
True if the keycode is a gamepad button, such as KEYCODE_BUTTON_A . |
isLongPress
fun isLongPress(): Boolean
For ACTION_DOWN
events, indicates that the event has been canceled as per FLAG_LONG_PRESS
.
isMediaSessionKey
static fun isMediaSessionKey(keyCode: Int): Boolean
Returns whether this key will be sent to the if not handled.
The following key codes are considered android.media.session.MediaSession
keys:
isMetaPressed
fun isMetaPressed(): Boolean
Returns the pressed state of the META meta key.
Return | |
---|---|
Boolean |
true if the META key is pressed, false otherwise |
isModifierKey
open static fun isModifierKey(keyCode: Int): Boolean
Returns true if this key code is a modifier key.
For the purposes of this function, KEYCODE_CAPS_LOCK
, KEYCODE_SCROLL_LOCK
, and KEYCODE_NUM_LOCK
are not considered modifier keys. Consequently, this function return false for those keys.
Return | |
---|---|
Boolean |
True if the key code is one of KEYCODE_SHIFT_LEFT KEYCODE_SHIFT_RIGHT , KEYCODE_ALT_LEFT , KEYCODE_ALT_RIGHT , KEYCODE_CTRL_LEFT , KEYCODE_CTRL_RIGHT , KEYCODE_META_LEFT , or KEYCODE_META_RIGHT , KEYCODE_SYM , KEYCODE_NUM , KEYCODE_FUNCTION . |
isNumLockOn
fun isNumLockOn(): Boolean
Returns the locked state of the NUM LOCK meta key.
Return | |
---|---|
Boolean |
true if the NUM LOCK key is on, false otherwise |
See Also
isPrintingKey
open fun isPrintingKey(): Boolean
Returns true if this key produces a glyph.
Return | |
---|---|
Boolean |
True if the key is a printing key. |
isScrollLockOn
fun isScrollLockOn(): Boolean
Returns the locked state of the SCROLL LOCK meta key.
Return | |
---|---|
Boolean |
true if the SCROLL LOCK key is on, false otherwise |
See Also
isShiftPressed
fun isShiftPressed(): Boolean
Returns the pressed state of the SHIFT meta key.
Return | |
---|---|
Boolean |
true if the SHIFT key is pressed, false otherwise |
isSymPressed
fun isSymPressed(): Boolean
Returns the pressed state of the SYM meta key.
Return | |
---|---|
Boolean |
true if the SYM key is pressed, false otherwise |
See Also
isSystem
fun isSystem(): Boolean
Is this a system key? System keys can not be used for menu shortcuts.
isTracking
fun isTracking(): Boolean
For ACTION_UP
events, indicates that the event is still being tracked from its initial down event as per FLAG_TRACKING
.
keyCodeFromString
open static fun keyCodeFromString(symbolicName: String): Int
Gets a keycode by its symbolic name such as "KEYCODE_A" or an equivalent numeric constant such as "29". For symbolic names, starting in android.os.Build.VERSION_CODES#Q
the prefix "KEYCODE_" is optional.
Parameters | |
---|---|
symbolicName |
String: The symbolic name of the keycode. This value cannot be null . |
Return | |
---|---|
Int |
The keycode or KEYCODE_UNKNOWN if not found. |
See Also
keyCodeToString
open static fun keyCodeToString(keyCode: Int): String!
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. This function is intended to be used mostly for debugging, logging, and testing. It is not locale-specific and is not intended to be used in a user-facing manner.
Parameters | |
---|---|
keyCode |
Int: The key code. |
Return | |
---|---|
String! |
The symbolic name of the specified keycode. |
metaStateHasModifiers
open static fun metaStateHasModifiers(
metaState: Int,
modifiers: Int
): Boolean
Returns true if only the specified modifier keys are pressed according to the specified meta state. Returns false if a different combination of modifier keys are pressed.
For the purposes of this function, KEYCODE_CAPS_LOCK
, KEYCODE_SCROLL_LOCK
, and KEYCODE_NUM_LOCK
are not considered modifier keys. Consequently, this function ignores META_CAPS_LOCK_ON
, META_SCROLL_LOCK_ON
and META_NUM_LOCK_ON
.
If the specified modifier mask includes directional modifiers, such as META_SHIFT_LEFT_ON
, then this method ensures that the modifier is pressed on that side. If the specified modifier mask includes non-directional modifiers, such as META_SHIFT_ON
, then this method ensures that the modifier is pressed on either side. If the specified modifier mask includes both directional and non-directional modifiers for the same type of key, such as META_SHIFT_ON
and META_SHIFT_LEFT_ON
, then this method throws an illegal argument exception.
Parameters | |
---|---|
metaState |
Int: The meta state to consider. |
modifiers |
Int: The meta state of the modifier keys to check. May be a combination of modifier meta states as defined by getModifierMetaStateMask() . May be 0 to ensure that no modifier keys are pressed. |
Return | |
---|---|
Boolean |
True if only the specified modifier keys are pressed. |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
if the modifiers parameter contains invalid modifiers |
See Also
metaStateHasNoModifiers
open static fun metaStateHasNoModifiers(metaState: Int): Boolean
Returns true if no modifiers keys are pressed according to the specified meta state.
For the purposes of this function, KEYCODE_CAPS_LOCK
, KEYCODE_SCROLL_LOCK
, and KEYCODE_NUM_LOCK
are not considered modifier keys. Consequently, this function ignores META_CAPS_LOCK_ON
, META_SCROLL_LOCK_ON
and META_NUM_LOCK_ON
.
The meta state is normalized prior to comparison using normalizeMetaState(int)
.
Parameters | |
---|---|
metaState |
Int: The meta state to consider. |
Return | |
---|---|
Boolean |
True if no modifier keys are pressed. |
See Also
normalizeMetaState
open static fun normalizeMetaState(metaState: Int): Int
Normalizes the specified meta state.
The meta state is normalized such that if either the left or right modifier meta state bits are set then the result will also include the universal bit for that modifier.
If the specified meta state contains META_ALT_LEFT_ON
then the result will also contain META_ALT_ON
in addition to META_ALT_LEFT_ON
and the other bits that were specified in the input. The same is process is performed for shift, control and meta.
If the specified meta state contains synthetic meta states defined by MetaKeyKeyListener
, then those states are translated here and the original synthetic meta states are removed from the result. MetaKeyKeyListener.META_CAP_LOCKED
is translated to META_CAPS_LOCK_ON
. MetaKeyKeyListener.META_ALT_LOCKED
is translated to META_ALT_ON
. MetaKeyKeyListener.META_SYM_LOCKED
is translated to META_SYM_ON
.
Undefined meta state bits are removed.
Parameters | |
---|---|
metaState |
Int: The meta state. |
Return | |
---|---|
Int |
The normalized meta state. |
startTracking
fun startTracking(): Unit
Call this during Callback.onKeyDown
to have the system track the key through its final up (possibly including a long press). Note that only one key can be tracked at a time -- if another key down event is received while a previous one is being tracked, tracking is stopped on the previous event.
toString
open fun toString(): String
Return | |
---|---|
String |
a string representation of the object. |
writeToParcel
open fun writeToParcel(
out: Parcel,
flags: Int
): Unit
Parameters | |
---|---|
dest |
The Parcel in which the object should be written. This value cannot be null . |
flags |
Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE . Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE , and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |