| java.lang.Object | |
| ↳ | android.view.KeyEvent |
Contains constants for key events.
| Nested Classes | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| KeyEvent.Callback | |||||||||||
|
[Expand]
Inherited Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From interface
android.os.Parcelable
| |||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Create a new key event.
| |||||||||||
Create a new key event.
| |||||||||||
Create a new key event.
| |||||||||||
Create a new key event.
| |||||||||||
Create a new key event.
| |||||||||||
Copy an existing key event, modifying its time and repeat count.
| |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Describe the kinds of special objects contained in this Parcelable's
marshalled representation.
| |||||||||||
Deliver this key event to a KeyEvent.Callback interface.
| |||||||||||
Retrieve the action of this key event.
| |||||||||||
Get the character that is produced by putting accent on the character
c.
| |||||||||||
Return the id for the keyboard that this event came from.
| |||||||||||
Get the primary character for this key.
| |||||||||||
Retrieve the time of the most recent key down event,
in the uptimeMillis() time base.
| |||||||||||
Retrieve the time this event occurred,
in the uptimeMillis() time base.
| |||||||||||
Returns the flags for this key event.
| |||||||||||
Retrieve the key code of the key event.
| |||||||||||
Get the characters conversion data for the key event..
| |||||||||||
If one of the chars in the array can be generated by the keyCode of this
key event, return the char; otherwise return '\0'.
| |||||||||||
The same as getMatch(chars, 0).
| |||||||||||
Returns the state of the meta keys. | |||||||||||
Gets the number or symbol associated with the key.
| |||||||||||
Retrieve the repeat count of the event.
| |||||||||||
Retrieve the hardware key id of this key event. These values are not
reliable and vary from device to device.
| |||||||||||
Returns the Unicode character that the key would produce. | |||||||||||
Returns the Unicode character that the key would produce. | |||||||||||
Returns the pressed state of the ALT meta key. | |||||||||||
Returns true if this key code is a modifier key.
| |||||||||||
Does the key code of this key produce a glyph?
| |||||||||||
Returns the pressed state of the SHIFT meta key. | |||||||||||
Returns the pressed state of the SYM meta key. | |||||||||||
Is this a system key? System keys can not be used for menu shortcuts.
| |||||||||||
Returns a string containing a concise, human-readable description of the
receiver.
| |||||||||||
Flatten this object in to a Parcel.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
| |||||||||||
From interface android.os.Parcelable
| |||||||||||
getAction() value: the key has been pressed down.
getAction() value: multiple duplicate key events have occurred in a row. The {#link getRepeatCount() method returns the number of duplicates.
getAction() value: the key has been released.
This mask is set if the device woke because of this key event.
This mask is used to check whether the left ALT meta key is pressed.
This mask is used to check whether one of the ALT meta keys is pressed.
This mask is used to check whether the right the ALT meta key is pressed.
This mask is used to check whether the left SHIFT meta key is pressed.
This mask is used to check whether one of the SHIFT meta keys is pressed.
This mask is used to check whether the right SHIFT meta key is pressed.
This mask is used to check whether the SYM meta key is pressed.
Create a new key event.
| action | Action code: either ACTION_DOWN, ACTION_UP, or ACTION_MULTIPLE. |
|---|---|
| code | The key code. |
Create a new key event.
| downTime | The time (in uptimeMillis()) at which this key code originally went down. |
|---|---|
| eventTime | The time (in uptimeMillis()) at which this event happened. |
| action | Action code: either ACTION_DOWN, ACTION_UP, or ACTION_MULTIPLE. |
| code | The key code. |
| repeat | A repeat count for down events (> 0 if this is after the initial down) or event count for multiple events. |
Create a new key event.
| downTime | The time (in uptimeMillis()) at which this key code originally went down. |
|---|---|
| eventTime | The time (in uptimeMillis()) at which this event happened. |
| action | Action code: either ACTION_DOWN, ACTION_UP, or ACTION_MULTIPLE. |
| code | The key code. |
| repeat | A repeat count for down events (> 0 if this is after the initial down) or event count for multiple events. |
| metaState | Flags indicating which meta keys are currently pressed. |
Create a new key event.
| downTime | The time (in uptimeMillis()) at which this key code originally went down. |
|---|---|
| eventTime | The time (in uptimeMillis()) at which this event happened. |
| action | Action code: either ACTION_DOWN, ACTION_UP, or ACTION_MULTIPLE. |
| code | The key code. |
| repeat | A repeat count for down events (> 0 if this is after the initial down) or event count for multiple events. |
| metaState | Flags indicating which meta keys are currently pressed. |
| device | The device ID that generated the key event. |
| scancode | Raw device scan code of the event. |
Create a new key event.
| downTime | The time (in uptimeMillis()) at which this key code originally went down. |
|---|---|
| eventTime | The time (in uptimeMillis()) at which this event happened. |
| action | Action code: either ACTION_DOWN, ACTION_UP, or ACTION_MULTIPLE. |
| code | The key code. |
| repeat | A repeat count for down events (> 0 if this is after the initial down) or event count for multiple events. |
| metaState | Flags indicating which meta keys are currently pressed. |
| device | The device ID that generated the key event. |
| scancode | Raw device scan code of the event. |
| flags | The flags for this key event |
Copy an existing key event, modifying its time and repeat count.
| origEvent | The existing event to be copied. |
|---|---|
| eventTime | The new event time (in uptimeMillis()) of the event. |
| newRepeat | The new repeat count of the event. |
Describe the kinds of special objects contained in this Parcelable's marshalled representation.
Deliver this key event to a KeyEvent.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.
| receiver | The Callback that will be given the event. |
|---|
Retrieve the action of this key event. May be either ACTION_DOWN, ACTION_UP, or ACTION_MULTIPLE.
Get the character that is produced by putting accent on the character c. For example, getDeadChar('`', 'e') returns è.
Return the id for the keyboard that this event came from. A device id of 0 indicates 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.
Get the primary character for this key. In other words, the label that is physically printed on it.
Retrieve the time of the most recent key down event, in the 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.
Retrieve the time this event occurred, in the uptimeMillis() time base.
Returns the flags for this key event.
Retrieve the key code of the key event. This is the physical key that was pressed -- not the Unicode character.
Get the characters conversion data for the key event..
| results | a KeyCharacterMap.KeyData that will be filled with the results. |
|---|
If one of the chars in the array can be generated by the keyCode of this key event, return the char; otherwise return '\0'.
| chars | the characters to try to find |
|---|---|
| modifiers | the modifier bits to prefer. If any of these bits are set, if there are multiple choices, that could work, the one for this modifier will be set. |
The same as getMatch(chars, 0).
Returns the state of the meta keys.
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.
Retrieve the repeat count of the event. For both key up and 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 multiple key events, this is the number of down/up pairs that have occurred.
Retrieve the hardware key id of this key event. These values are not reliable and vary from device to device.
Mostly this is here for debugging purposes.
Returns the Unicode character that the key would produce.
Returns 0 if the key is not one that is used to type Unicode characters.
If the return value has bit COMBINING_ACCENT set, the key is a "dead key" that should be combined with another to actually produce a character -- see getDeadChar(int, int) -- after masking with COMBINING_ACCENT_MASK.
Returns the Unicode character that the key would produce.
Returns 0 if the key is not one that is used to type Unicode characters.
If the return value has bit COMBINING_ACCENT set, the key is a "dead key" that should be combined with another to actually produce a character -- see getDeadChar(int, int) -- after masking with COMBINING_ACCENT_MASK.
Returns the pressed state of the ALT meta key.
Returns true if this key code is a modifier key.
Does the key code of this key produce a glyph?
Returns the pressed state of the SHIFT meta key.
Returns the pressed state of the SYM meta key.
Is this a system key? System keys can not be used for menu shortcuts. TODO: this information should come from a table somewhere. TODO: should the dpad keys be here? arguably, because they also shouldn't be menu shortcuts
Returns a string containing a concise, human-readable description of the receiver.
Flatten this object in to a Parcel.
| out | The Parcel in which the object should be written. |
|---|---|
| flags | Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. |