Fields Summary |
---|
public static final int | KEYCODE_UNKNOWNKey code constant: Unknown key code. |
public static final int | KEYCODE_SOFT_LEFTKey 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. |
public static final int | KEYCODE_SOFT_RIGHTKey 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. |
public static final int | KEYCODE_HOMEKey code constant: Home key.
This key is handled by the framework and is never delivered to applications. |
public static final int | KEYCODE_BACKKey code constant: Back key. |
public static final int | KEYCODE_CALLKey code constant: Call key. |
public static final int | KEYCODE_ENDCALLKey code constant: End Call key. |
public static final int | KEYCODE_0Key code constant: '0' key. |
public static final int | KEYCODE_1Key code constant: '1' key. |
public static final int | KEYCODE_2Key code constant: '2' key. |
public static final int | KEYCODE_3Key code constant: '3' key. |
public static final int | KEYCODE_4Key code constant: '4' key. |
public static final int | KEYCODE_5Key code constant: '5' key. |
public static final int | KEYCODE_6Key code constant: '6' key. |
public static final int | KEYCODE_7Key code constant: '7' key. |
public static final int | KEYCODE_8Key code constant: '8' key. |
public static final int | KEYCODE_9Key code constant: '9' key. |
public static final int | KEYCODE_STARKey code constant: '*' key. |
public static final int | KEYCODE_POUNDKey code constant: '#' key. |
public static final int | KEYCODE_DPAD_UPKey code constant: Directional Pad Up key.
May also be synthesized from trackball motions. |
public static final int | KEYCODE_DPAD_DOWNKey code constant: Directional Pad Down key.
May also be synthesized from trackball motions. |
public static final int | KEYCODE_DPAD_LEFTKey code constant: Directional Pad Left key.
May also be synthesized from trackball motions. |
public static final int | KEYCODE_DPAD_RIGHTKey code constant: Directional Pad Right key.
May also be synthesized from trackball motions. |
public static final int | KEYCODE_DPAD_CENTERKey code constant: Directional Pad Center key.
May also be synthesized from trackball motions. |
public static final int | KEYCODE_VOLUME_UPKey code constant: Volume Up key.
Adjusts the speaker volume up. |
public static final int | KEYCODE_VOLUME_DOWNKey code constant: Volume Down key.
Adjusts the speaker volume down. |
public static final int | KEYCODE_POWERKey code constant: Power key. |
public static final int | KEYCODE_CAMERAKey code constant: Camera key.
Used to launch a camera application or take pictures. |
public static final int | KEYCODE_CLEARKey code constant: Clear key. |
public static final int | KEYCODE_AKey code constant: 'A' key. |
public static final int | KEYCODE_BKey code constant: 'B' key. |
public static final int | KEYCODE_CKey code constant: 'C' key. |
public static final int | KEYCODE_DKey code constant: 'D' key. |
public static final int | KEYCODE_EKey code constant: 'E' key. |
public static final int | KEYCODE_FKey code constant: 'F' key. |
public static final int | KEYCODE_GKey code constant: 'G' key. |
public static final int | KEYCODE_HKey code constant: 'H' key. |
public static final int | KEYCODE_IKey code constant: 'I' key. |
public static final int | KEYCODE_JKey code constant: 'J' key. |
public static final int | KEYCODE_KKey code constant: 'K' key. |
public static final int | KEYCODE_LKey code constant: 'L' key. |
public static final int | KEYCODE_MKey code constant: 'M' key. |
public static final int | KEYCODE_NKey code constant: 'N' key. |
public static final int | KEYCODE_OKey code constant: 'O' key. |
public static final int | KEYCODE_PKey code constant: 'P' key. |
public static final int | KEYCODE_QKey code constant: 'Q' key. |
public static final int | KEYCODE_RKey code constant: 'R' key. |
public static final int | KEYCODE_SKey code constant: 'S' key. |
public static final int | KEYCODE_TKey code constant: 'T' key. |
public static final int | KEYCODE_UKey code constant: 'U' key. |
public static final int | KEYCODE_VKey code constant: 'V' key. |
public static final int | KEYCODE_WKey code constant: 'W' key. |
public static final int | KEYCODE_XKey code constant: 'X' key. |
public static final int | KEYCODE_YKey code constant: 'Y' key. |
public static final int | KEYCODE_ZKey code constant: 'Z' key. |
public static final int | KEYCODE_COMMAKey code constant: ',' key. |
public static final int | KEYCODE_PERIODKey code constant: '.' key. |
public static final int | KEYCODE_ALT_LEFTKey code constant: Left Alt modifier key. |
public static final int | KEYCODE_ALT_RIGHTKey code constant: Right Alt modifier key. |
public static final int | KEYCODE_SHIFT_LEFTKey code constant: Left Shift modifier key. |
public static final int | KEYCODE_SHIFT_RIGHTKey code constant: Right Shift modifier key. |
public static final int | KEYCODE_TABKey code constant: Tab key. |
public static final int | KEYCODE_SPACEKey code constant: Space key. |
public static final int | KEYCODE_SYMKey code constant: Symbol modifier key.
Used to enter alternate symbols. |
public static final int | KEYCODE_EXPLORERKey code constant: Explorer special function key.
Used to launch a browser application. |
public static final int | KEYCODE_ENVELOPEKey code constant: Envelope special function key.
Used to launch a mail application. |
public static final int | KEYCODE_ENTERKey code constant: Enter key. |
public static final int | KEYCODE_DELKey code constant: Backspace key.
Deletes characters before the insertion point, unlike {@link #KEYCODE_FORWARD_DEL}. |
public static final int | KEYCODE_GRAVEKey code constant: '`' (backtick) key. |
public static final int | KEYCODE_MINUSKey code constant: '-'. |
public static final int | KEYCODE_EQUALSKey code constant: '=' key. |
public static final int | KEYCODE_LEFT_BRACKETKey code constant: '[' key. |
public static final int | KEYCODE_RIGHT_BRACKETKey code constant: ']' key. |
public static final int | KEYCODE_BACKSLASHKey code constant: '\' key. |
public static final int | KEYCODE_SEMICOLONKey code constant: ';' key. |
public static final int | KEYCODE_APOSTROPHEKey code constant: ''' (apostrophe) key. |
public static final int | KEYCODE_SLASHKey code constant: '/' key. |
public static final int | KEYCODE_ATKey code constant: '@' key. |
public static final int | KEYCODE_NUMKey code constant: Number modifier key.
Used to enter numeric symbols.
This key is not Num Lock; it is more like {@link #KEYCODE_ALT_LEFT} and is
interpreted as an ALT key by {@link android.text.method.MetaKeyKeyListener}. |
public static final int | KEYCODE_HEADSETHOOKKey code constant: Headset Hook key.
Used to hang up calls and stop media. |
public static final int | KEYCODE_FOCUSKey code constant: Camera Focus key.
Used to focus the camera. |
public static final int | KEYCODE_PLUSKey code constant: '+' key. |
public static final int | KEYCODE_MENUKey code constant: Menu key. |
public static final int | KEYCODE_NOTIFICATIONKey code constant: Notification key. |
public static final int | KEYCODE_SEARCHKey code constant: Search key. |
public static final int | KEYCODE_MEDIA_PLAY_PAUSEKey code constant: Play/Pause media key. |
public static final int | KEYCODE_MEDIA_STOPKey code constant: Stop media key. |
public static final int | KEYCODE_MEDIA_NEXTKey code constant: Play Next media key. |
public static final int | KEYCODE_MEDIA_PREVIOUSKey code constant: Play Previous media key. |
public static final int | KEYCODE_MEDIA_REWINDKey code constant: Rewind media key. |
public static final int | KEYCODE_MEDIA_FAST_FORWARDKey code constant: Fast Forward media key. |
public static final int | KEYCODE_MUTEKey code constant: Mute key.
Mutes the microphone, unlike {@link #KEYCODE_VOLUME_MUTE}. |
public static final int | KEYCODE_PAGE_UPKey code constant: Page Up key. |
public static final int | KEYCODE_PAGE_DOWNKey code constant: Page Down key. |
public static final int | KEYCODE_PICTSYMBOLSKey code constant: Picture Symbols modifier key.
Used to switch symbol sets (Emoji, Kao-moji). |
public static final int | KEYCODE_SWITCH_CHARSETKey code constant: Switch Charset modifier key.
Used to switch character sets (Kanji, Katakana). |
public static final int | KEYCODE_BUTTON_AKey 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. |
public static final int | KEYCODE_BUTTON_BKey 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. |
public static final int | KEYCODE_BUTTON_CKey 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. |
public static final int | KEYCODE_BUTTON_XKey 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. |
public static final int | KEYCODE_BUTTON_YKey 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. |
public static final int | KEYCODE_BUTTON_ZKey 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. |
public static final int | KEYCODE_BUTTON_L1Key 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. |
public static final int | KEYCODE_BUTTON_R1Key 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. |
public static final int | KEYCODE_BUTTON_L2Key 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. |
public static final int | KEYCODE_BUTTON_R2Key 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. |
public static final int | KEYCODE_BUTTON_THUMBLKey code constant: Left Thumb Button key.
On a game controller, the left thumb button indicates that the left (or only)
joystick is pressed. |
public static final int | KEYCODE_BUTTON_THUMBRKey code constant: Right Thumb Button key.
On a game controller, the right thumb button indicates that the right
joystick is pressed. |
public static final int | KEYCODE_BUTTON_STARTKey code constant: Start Button key.
On a game controller, the button labeled Start. |
public static final int | KEYCODE_BUTTON_SELECTKey code constant: Select Button key.
On a game controller, the button labeled Select. |
public static final int | KEYCODE_BUTTON_MODEKey code constant: Mode Button key.
On a game controller, the button labeled Mode. |
public static final int | KEYCODE_ESCAPEKey code constant: Escape key. |
public static final int | KEYCODE_FORWARD_DELKey code constant: Forward Delete key.
Deletes characters ahead of the insertion point, unlike {@link #KEYCODE_DEL}. |
public static final int | KEYCODE_CTRL_LEFTKey code constant: Left Control modifier key. |
public static final int | KEYCODE_CTRL_RIGHTKey code constant: Right Control modifier key. |
public static final int | KEYCODE_CAPS_LOCKKey code constant: Caps Lock key. |
public static final int | KEYCODE_SCROLL_LOCKKey code constant: Scroll Lock key. |
public static final int | KEYCODE_META_LEFTKey code constant: Left Meta modifier key. |
public static final int | KEYCODE_META_RIGHTKey code constant: Right Meta modifier key. |
public static final int | KEYCODE_FUNCTIONKey code constant: Function modifier key. |
public static final int | KEYCODE_SYSRQKey code constant: System Request / Print Screen key. |
public static final int | KEYCODE_BREAKKey code constant: Break / Pause key. |
public static final int | KEYCODE_MOVE_HOMEKey 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. |
public static final int | KEYCODE_MOVE_ENDKey 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. |
public static final int | KEYCODE_INSERTKey code constant: Insert key.
Toggles insert / overwrite edit mode. |
public static final int | KEYCODE_FORWARDKey code constant: Forward key.
Navigates forward in the history stack. Complement of {@link #KEYCODE_BACK}. |
public static final int | KEYCODE_MEDIA_PLAYKey code constant: Play media key. |
public static final int | KEYCODE_MEDIA_PAUSEKey code constant: Pause media key. |
public static final int | KEYCODE_MEDIA_CLOSEKey code constant: Close media key.
May be used to close a CD tray, for example. |
public static final int | KEYCODE_MEDIA_EJECTKey code constant: Eject media key.
May be used to eject a CD tray, for example. |
public static final int | KEYCODE_MEDIA_RECORDKey code constant: Record media key. |
public static final int | KEYCODE_F1Key code constant: F1 key. |
public static final int | KEYCODE_F2Key code constant: F2 key. |
public static final int | KEYCODE_F3Key code constant: F3 key. |
public static final int | KEYCODE_F4Key code constant: F4 key. |
public static final int | KEYCODE_F5Key code constant: F5 key. |
public static final int | KEYCODE_F6Key code constant: F6 key. |
public static final int | KEYCODE_F7Key code constant: F7 key. |
public static final int | KEYCODE_F8Key code constant: F8 key. |
public static final int | KEYCODE_F9Key code constant: F9 key. |
public static final int | KEYCODE_F10Key code constant: F10 key. |
public static final int | KEYCODE_F11Key code constant: F11 key. |
public static final int | KEYCODE_F12Key code constant: F12 key. |
public static final int | KEYCODE_NUM_LOCKKey code constant: Num Lock key.
This is the Num Lock key; it is different from {@link #KEYCODE_NUM}.
This key alters the behavior of other keys on the numeric keypad. |
public static final int | KEYCODE_NUMPAD_0Key code constant: Numeric keypad '0' key. |
public static final int | KEYCODE_NUMPAD_1Key code constant: Numeric keypad '1' key. |
public static final int | KEYCODE_NUMPAD_2Key code constant: Numeric keypad '2' key. |
public static final int | KEYCODE_NUMPAD_3Key code constant: Numeric keypad '3' key. |
public static final int | KEYCODE_NUMPAD_4Key code constant: Numeric keypad '4' key. |
public static final int | KEYCODE_NUMPAD_5Key code constant: Numeric keypad '5' key. |
public static final int | KEYCODE_NUMPAD_6Key code constant: Numeric keypad '6' key. |
public static final int | KEYCODE_NUMPAD_7Key code constant: Numeric keypad '7' key. |
public static final int | KEYCODE_NUMPAD_8Key code constant: Numeric keypad '8' key. |
public static final int | KEYCODE_NUMPAD_9Key code constant: Numeric keypad '9' key. |
public static final int | KEYCODE_NUMPAD_DIVIDEKey code constant: Numeric keypad '/' key (for division). |
public static final int | KEYCODE_NUMPAD_MULTIPLYKey code constant: Numeric keypad '*' key (for multiplication). |
public static final int | KEYCODE_NUMPAD_SUBTRACTKey code constant: Numeric keypad '-' key (for subtraction). |
public static final int | KEYCODE_NUMPAD_ADDKey code constant: Numeric keypad '+' key (for addition). |
public static final int | KEYCODE_NUMPAD_DOTKey code constant: Numeric keypad '.' key (for decimals or digit grouping). |
public static final int | KEYCODE_NUMPAD_COMMAKey code constant: Numeric keypad ',' key (for decimals or digit grouping). |
public static final int | KEYCODE_NUMPAD_ENTERKey code constant: Numeric keypad Enter key. |
public static final int | KEYCODE_NUMPAD_EQUALSKey code constant: Numeric keypad '=' key. |
public static final int | KEYCODE_NUMPAD_LEFT_PARENKey code constant: Numeric keypad '(' key. |
public static final int | KEYCODE_NUMPAD_RIGHT_PARENKey code constant: Numeric keypad ')' key. |
public static final int | KEYCODE_VOLUME_MUTEKey code constant: Volume Mute key.
Mutes the speaker, unlike {@link #KEYCODE_MUTE}.
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. |
public static final int | KEYCODE_INFOKey code constant: Info key.
Common on TV remotes to show additional information related to what is
currently being viewed. |
public static final int | KEYCODE_CHANNEL_UPKey code constant: Channel up key.
On TV remotes, increments the television channel. |
public static final int | KEYCODE_CHANNEL_DOWNKey code constant: Channel down key.
On TV remotes, decrements the television channel. |
public static final int | KEYCODE_ZOOM_INKey code constant: Zoom in key. |
public static final int | KEYCODE_ZOOM_OUTKey code constant: Zoom out key. |
public static final int | KEYCODE_TVKey code constant: TV key.
On TV remotes, switches to viewing live TV. |
public static final int | KEYCODE_WINDOWKey code constant: Window key.
On TV remotes, toggles picture-in-picture mode or other windowing functions. |
public static final int | KEYCODE_GUIDEKey code constant: Guide key.
On TV remotes, shows a programming guide. |
public static final int | KEYCODE_DVRKey code constant: DVR key.
On some TV remotes, switches to a DVR mode for recorded shows. |
public static final int | KEYCODE_BOOKMARKKey code constant: Bookmark key.
On some TV remotes, bookmarks content or web pages. |
public static final int | KEYCODE_CAPTIONSKey code constant: Toggle captions key.
Switches the mode for closed-captioning text, for example during television shows. |
public static final int | KEYCODE_SETTINGSKey code constant: Settings key.
Starts the system settings activity. |
public static final int | KEYCODE_TV_POWERKey code constant: TV power key.
On TV remotes, toggles the power on a television screen. |
public static final int | KEYCODE_TV_INPUTKey code constant: TV input key.
On TV remotes, switches the input on a television screen. |
public static final int | KEYCODE_STB_POWERKey code constant: Set-top-box power key.
On TV remotes, toggles the power on an external Set-top-box. |
public static final int | KEYCODE_STB_INPUTKey code constant: Set-top-box input key.
On TV remotes, switches the input mode on an external Set-top-box. |
public static final int | KEYCODE_AVR_POWERKey code constant: A/V Receiver power key.
On TV remotes, toggles the power on an external A/V Receiver. |
public static final int | KEYCODE_AVR_INPUTKey code constant: A/V Receiver input key.
On TV remotes, switches the input mode on an external A/V Receiver. |
public static final int | KEYCODE_PROG_REDKey code constant: Red "programmable" key.
On TV remotes, acts as a contextual/programmable key. |
public static final int | KEYCODE_PROG_GREENKey code constant: Green "programmable" key.
On TV remotes, actsas a contextual/programmable key. |
public static final int | KEYCODE_PROG_YELLOWKey code constant: Yellow "programmable" key.
On TV remotes, acts as a contextual/programmable key. |
public static final int | KEYCODE_PROG_BLUEKey code constant: Blue "programmable" key.
On TV remotes, acts as a contextual/programmable key. |
public static final int | KEYCODE_APP_SWITCHKey code constant: App switch key.
Should bring up the application switcher dialog. |
public static final int | KEYCODE_BUTTON_1Key code constant: Generic Game Pad Button #1. |
public static final int | KEYCODE_BUTTON_2Key code constant: Generic Game Pad Button #2. |
public static final int | KEYCODE_BUTTON_3Key code constant: Generic Game Pad Button #3. |
public static final int | KEYCODE_BUTTON_4Key code constant: Generic Game Pad Button #4. |
public static final int | KEYCODE_BUTTON_5Key code constant: Generic Game Pad Button #5. |
public static final int | KEYCODE_BUTTON_6Key code constant: Generic Game Pad Button #6. |
public static final int | KEYCODE_BUTTON_7Key code constant: Generic Game Pad Button #7. |
public static final int | KEYCODE_BUTTON_8Key code constant: Generic Game Pad Button #8. |
public static final int | KEYCODE_BUTTON_9Key code constant: Generic Game Pad Button #9. |
public static final int | KEYCODE_BUTTON_10Key code constant: Generic Game Pad Button #10. |
public static final int | KEYCODE_BUTTON_11Key code constant: Generic Game Pad Button #11. |
public static final int | KEYCODE_BUTTON_12Key code constant: Generic Game Pad Button #12. |
public static final int | KEYCODE_BUTTON_13Key code constant: Generic Game Pad Button #13. |
public static final int | KEYCODE_BUTTON_14Key code constant: Generic Game Pad Button #14. |
public static final int | KEYCODE_BUTTON_15Key code constant: Generic Game Pad Button #15. |
public static final int | KEYCODE_BUTTON_16Key code constant: Generic Game Pad Button #16. |
public static final int | KEYCODE_LANGUAGE_SWITCHKey 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. |
public static final int | KEYCODE_MANNER_MODEKey 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. |
public static final int | KEYCODE_3D_MODEKey code constant: 3D Mode key.
Toggles the display between 2D and 3D mode. |
public static final int | KEYCODE_CONTACTSKey code constant: Contacts special function key.
Used to launch an address book application. |
public static final int | KEYCODE_CALENDARKey code constant: Calendar special function key.
Used to launch a calendar application. |
public static final int | KEYCODE_MUSICKey code constant: Music special function key.
Used to launch a music player application. |
public static final int | KEYCODE_CALCULATORKey code constant: Calculator special function key.
Used to launch a calculator application. |
public static final int | KEYCODE_ZENKAKU_HANKAKUKey code constant: Japanese full-width / half-width key. |
public static final int | KEYCODE_EISUKey code constant: Japanese alphanumeric key. |
public static final int | KEYCODE_MUHENKANKey code constant: Japanese non-conversion key. |
public static final int | KEYCODE_HENKANKey code constant: Japanese conversion key. |
public static final int | KEYCODE_KATAKANA_HIRAGANAKey code constant: Japanese katakana / hiragana key. |
public static final int | KEYCODE_YENKey code constant: Japanese Yen key. |
public static final int | KEYCODE_ROKey code constant: Japanese Ro key. |
public static final int | KEYCODE_KANAKey code constant: Japanese kana key. |
public static final int | KEYCODE_ASSISTKey code constant: Assist key.
Launches the global assist activity. Not delivered to applications. |
public static final int | KEYCODE_BRIGHTNESS_DOWNKey code constant: Brightness Down key.
Adjusts the screen brightness down. |
public static final int | KEYCODE_BRIGHTNESS_UPKey code constant: Brightness Up key.
Adjusts the screen brightness up. |
public static final int | KEYCODE_MEDIA_AUDIO_TRACKKey code constant: Audio Track key.
Switches the audio tracks. |
public static final int | KEYCODE_SLEEPKey code constant: Sleep key.
Puts the device to sleep. Behaves somewhat like {@link #KEYCODE_POWER} but it
has no effect if the device is already asleep. |
public static final int | KEYCODE_WAKEUPKey code constant: Wakeup key.
Wakes up the device. Behaves somewhat like {@link #KEYCODE_POWER} but it
has no effect if the device is already awake. |
public static final int | KEYCODE_PAIRINGKey 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. |
public static final int | KEYCODE_MEDIA_TOP_MENUKey code constant: Media Top Menu key.
Goes to the top of media menu. |
public static final int | KEYCODE_11Key code constant: '11' key. |
public static final int | KEYCODE_12Key code constant: '12' key. |
public static final int | KEYCODE_LAST_CHANNELKey code constant: Last Channel key.
Goes to the last viewed channel. |
public static final int | KEYCODE_TV_DATA_SERVICEKey code constant: TV data service key.
Displays data services like weather, sports. |
public static final int | KEYCODE_VOICE_ASSISTKey code constant: Voice Assist key.
Launches the global voice assist activity. Not delivered to applications. |
public static final int | KEYCODE_TV_RADIO_SERVICEKey code constant: Radio key.
Toggles TV service / Radio service. |
public static final int | KEYCODE_TV_TELETEXTKey code constant: Teletext key.
Displays Teletext service. |
public static final int | KEYCODE_TV_NUMBER_ENTRYKey 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. |
public static final int | KEYCODE_TV_TERRESTRIAL_ANALOGKey code constant: Analog Terrestrial key.
Switches to analog terrestrial broadcast service. |
public static final int | KEYCODE_TV_TERRESTRIAL_DIGITALKey code constant: Digital Terrestrial key.
Switches to digital terrestrial broadcast service. |
public static final int | KEYCODE_TV_SATELLITEKey code constant: Satellite key.
Switches to digital satellite broadcast service. |
public static final int | KEYCODE_TV_SATELLITE_BSKey code constant: BS key.
Switches to BS digital satellite broadcasting service available in Japan. |
public static final int | KEYCODE_TV_SATELLITE_CSKey code constant: CS key.
Switches to CS digital satellite broadcasting service available in Japan. |
public static final int | KEYCODE_TV_SATELLITE_SERVICEKey code constant: BS/CS key.
Toggles between BS and CS digital satellite services. |
public static final int | KEYCODE_TV_NETWORKKey code constant: Toggle Network key.
Toggles selecting broacast services. |
public static final int | KEYCODE_TV_ANTENNA_CABLEKey code constant: Antenna/Cable key.
Toggles broadcast input source between antenna and cable. |
public static final int | KEYCODE_TV_INPUT_HDMI_1Key code constant: HDMI #1 key.
Switches to HDMI input #1. |
public static final int | KEYCODE_TV_INPUT_HDMI_2Key code constant: HDMI #2 key.
Switches to HDMI input #2. |
public static final int | KEYCODE_TV_INPUT_HDMI_3Key code constant: HDMI #3 key.
Switches to HDMI input #3. |
public static final int | KEYCODE_TV_INPUT_HDMI_4Key code constant: HDMI #4 key.
Switches to HDMI input #4. |
public static final int | KEYCODE_TV_INPUT_COMPOSITE_1Key code constant: Composite #1 key.
Switches to composite video input #1. |
public static final int | KEYCODE_TV_INPUT_COMPOSITE_2Key code constant: Composite #2 key.
Switches to composite video input #2. |
public static final int | KEYCODE_TV_INPUT_COMPONENT_1Key code constant: Component #1 key.
Switches to component video input #1. |
public static final int | KEYCODE_TV_INPUT_COMPONENT_2Key code constant: Component #2 key.
Switches to component video input #2. |
public static final int | KEYCODE_TV_INPUT_VGA_1Key code constant: VGA #1 key.
Switches to VGA (analog RGB) input #1. |
public static final int | KEYCODE_TV_AUDIO_DESCRIPTIONKey code constant: Audio description key.
Toggles audio description off / on. |
public static final int | KEYCODE_TV_AUDIO_DESCRIPTION_MIX_UPKey code constant: Audio description mixing volume up key.
Louden audio description volume as compared with normal audio volume. |
public static final int | KEYCODE_TV_AUDIO_DESCRIPTION_MIX_DOWNKey code constant: Audio description mixing volume down key.
Lessen audio description volume as compared with normal audio volume. |
public static final int | KEYCODE_TV_ZOOM_MODEKey code constant: Zoom mode key.
Changes Zoom mode (Normal, Full, Zoom, Wide-zoom, etc.) |
public static final int | KEYCODE_TV_CONTENTS_MENUKey code constant: Contents menu key.
Goes to the title list. Corresponds to Contents Menu (0x0B) of CEC User Control
Code |
public static final int | KEYCODE_TV_MEDIA_CONTEXT_MENUKey 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. |
public static final int | KEYCODE_TV_TIMER_PROGRAMMINGKey code constant: Timer programming key.
Goes to the timer recording menu. Corresponds to Timer Programming (0x54) of
CEC User Control Code. |
public static final int | KEYCODE_HELPKey code constant: Help key. |
private static final int | LAST_KEYCODE |
private static final String[] | META_SYMBOLIC_NAMES |
private static final String | LABEL_PREFIX |
public static final int | MAX_KEYCODE |
public static final int | ACTION_DOWN{@link #getAction} value: the key has been pressed down. |
public static final int | ACTION_UP{@link #getAction} value: the key has been released. |
public static final int | ACTION_MULTIPLE{@link #getAction} value: multiple duplicate key events have
occurred in a row, or a complex string is being delivered. If the
key code is not {#link {@link #KEYCODE_UNKNOWN} then the
{#link {@link #getRepeatCount()} method returns the number of times
the given key code should be executed.
Otherwise, if the key code is {@link #KEYCODE_UNKNOWN}, then
this is a sequence of characters as returned by {@link #getCharacters}. |
public static final int | META_CAP_LOCKEDSHIFT key locked in CAPS mode.
Reserved for use by {@link MetaKeyKeyListener} for a published constant in its API. |
public static final int | META_ALT_LOCKEDALT key locked.
Reserved for use by {@link MetaKeyKeyListener} for a published constant in its API. |
public static final int | META_SYM_LOCKEDSYM key locked.
Reserved for use by {@link MetaKeyKeyListener} for a published constant in its API. |
public static final int | META_SELECTINGText is in selection mode.
Reserved for use by {@link MetaKeyKeyListener} for a private unpublished constant
in its API that is currently being retained for legacy reasons. |
public static final int | META_ALT_ON This mask is used to check whether one of the ALT meta keys is pressed. |
public static final int | META_ALT_LEFT_ON This mask is used to check whether the left ALT meta key is pressed. |
public static final int | META_ALT_RIGHT_ON This mask is used to check whether the right the ALT meta key is pressed. |
public static final int | META_SHIFT_ON This mask is used to check whether one of the SHIFT meta keys is pressed. |
public static final int | META_SHIFT_LEFT_ON This mask is used to check whether the left SHIFT meta key is pressed. |
public static final int | META_SHIFT_RIGHT_ON This mask is used to check whether the right SHIFT meta key is pressed. |
public static final int | META_SYM_ON This mask is used to check whether the SYM meta key is pressed. |
public static final int | META_FUNCTION_ON This mask is used to check whether the FUNCTION meta key is pressed. |
public static final int | META_CTRL_ON This mask is used to check whether one of the CTRL meta keys is pressed. |
public static final int | META_CTRL_LEFT_ON This mask is used to check whether the left CTRL meta key is pressed. |
public static final int | META_CTRL_RIGHT_ON This mask is used to check whether the right CTRL meta key is pressed. |
public static final int | META_META_ON This mask is used to check whether one of the META meta keys is pressed. |
public static final int | META_META_LEFT_ON This mask is used to check whether the left META meta key is pressed. |
public static final int | META_META_RIGHT_ON This mask is used to check whether the right META meta key is pressed. |
public static final int | META_CAPS_LOCK_ON This mask is used to check whether the CAPS LOCK meta key is on. |
public static final int | META_NUM_LOCK_ON This mask is used to check whether the NUM LOCK meta key is on. |
public static final int | META_SCROLL_LOCK_ON This mask is used to check whether the SCROLL LOCK meta key is on. |
public static final int | META_SHIFT_MASKThis mask is a combination of {@link #META_SHIFT_ON}, {@link #META_SHIFT_LEFT_ON}
and {@link #META_SHIFT_RIGHT_ON}. |
public static final int | META_ALT_MASKThis mask is a combination of {@link #META_ALT_ON}, {@link #META_ALT_LEFT_ON}
and {@link #META_ALT_RIGHT_ON}. |
public static final int | META_CTRL_MASKThis mask is a combination of {@link #META_CTRL_ON}, {@link #META_CTRL_LEFT_ON}
and {@link #META_CTRL_RIGHT_ON}. |
public static final int | META_META_MASKThis mask is a combination of {@link #META_META_ON}, {@link #META_META_LEFT_ON}
and {@link #META_META_RIGHT_ON}. |
public static final int | FLAG_WOKE_HEREThis mask is set if the device woke because of this key event. |
public static final int | FLAG_SOFT_KEYBOARDThis mask is set if the key event was generated by a software keyboard. |
public static final int | FLAG_KEEP_TOUCH_MODEThis mask is set if we don't want the key event to cause us to leave
touch mode. |
public static final int | FLAG_FROM_SYSTEMThis 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. |
public static final int | FLAG_EDITOR_ACTIONThis 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. |
public static final int | FLAG_CANCELEDWhen 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. |
public static final int | FLAG_VIRTUAL_HARD_KEYThis 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. |
public static final int | FLAG_LONG_PRESSThis flag is set for the first key repeat that occurs after the
long press timeout. |
public static final int | FLAG_CANCELED_LONG_PRESSSet when a key event has {@link #FLAG_CANCELED} set because a long
press action was executed while it was down. |
public static final int | FLAG_TRACKINGSet for {@link #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. |
public static final int | FLAG_FALLBACKSet 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). |
public static final int | FLAG_PREDISPATCHSignifies that the key is being predispatched. |
public static final int | FLAG_START_TRACKINGPrivate control to determine when an app is tracking a key sequence. |
public static final int | FLAG_TAINTEDPrivate flag that indicates when the system has detected that this key event
may be inconsistent with respect to the sequence of previously delivered key events,
such as when a key up event is sent but the key was not down. |
static final boolean | DEBUG |
static final String | TAG |
private static final int | MAX_RECYCLED |
private static final Object | gRecyclerLock |
private static int | gRecyclerUsed |
private static KeyEvent | gRecyclerTop |
private KeyEvent | mNext |
private int | mDeviceId |
private int | mSource |
private int | mMetaState |
private int | mAction |
private int | mKeyCode |
private int | mScanCode |
private int | mRepeatCount |
private int | mFlags |
private long | mDownTime |
private long | mEventTime |
private String | mCharacters |
private static final int | META_MODIFIER_MASK |
private static final int | META_LOCK_MASK |
private static final int | META_ALL_MASK |
private static final int | META_SYNTHETIC_MASK |
private static final int | META_INVALID_MODIFIER_MASK |
public static final Parcelable.Creator | CREATOR |
Methods Summary |
---|
public static java.lang.String | actionToString(int action)Returns a string that represents the symbolic name of the specified action
such as "ACTION_DOWN", or an equivalent numeric constant such as "35" if unknown.
switch (action) {
case ACTION_DOWN:
return "ACTION_DOWN";
case ACTION_UP:
return "ACTION_UP";
case ACTION_MULTIPLE:
return "ACTION_MULTIPLE";
default:
return Integer.toString(action);
}
|
public final void | cancel()Set {@link #FLAG_CANCELED} flag for the key event.
mFlags |= FLAG_CANCELED;
|
public static android.view.KeyEvent | changeAction(android.view.KeyEvent event, int action)Create a new key event that is the same as the given one, but whose
action is replaced with the given value.
return new KeyEvent(event, action);
|
public static android.view.KeyEvent | changeFlags(android.view.KeyEvent event, int flags)Create a new key event that is the same as the given one, but whose
flags are replaced with the given value.
event = new KeyEvent(event);
event.mFlags = flags;
return event;
|
public static android.view.KeyEvent | changeTimeRepeat(android.view.KeyEvent event, long eventTime, int newRepeat)Create a new key event that is the same as the given one, but whose
event time and repeat count are replaced with the given value.
return new KeyEvent(event, eventTime, newRepeat);
|
public static android.view.KeyEvent | changeTimeRepeat(android.view.KeyEvent event, long eventTime, int newRepeat, int newFlags)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.
KeyEvent ret = new KeyEvent(event);
ret.mEventTime = eventTime;
ret.mRepeatCount = newRepeat;
ret.mFlags = newFlags;
return ret;
|
public android.view.KeyEvent | copy()
return obtain(this);
|
public static android.view.KeyEvent | createFromParcelBody(android.os.Parcel in)
return new KeyEvent(in);
|
public final boolean | dispatch(android.view.KeyEvent$Callback receiver)
return dispatch(receiver, null, null);
|
public final boolean | dispatch(android.view.KeyEvent$Callback receiver, android.view.KeyEvent$DispatcherState state, java.lang.Object target)Deliver this key event to a {@link 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.
switch (mAction) {
case ACTION_DOWN: {
mFlags &= ~FLAG_START_TRACKING;
if (DEBUG) Log.v(TAG, "Key down to " + target + " in " + state
+ ": " + this);
boolean res = receiver.onKeyDown(mKeyCode, this);
if (state != null) {
if (res && mRepeatCount == 0 && (mFlags&FLAG_START_TRACKING) != 0) {
if (DEBUG) Log.v(TAG, " Start tracking!");
state.startTracking(this, target);
} else if (isLongPress() && state.isTracking(this)) {
try {
if (receiver.onKeyLongPress(mKeyCode, this)) {
if (DEBUG) Log.v(TAG, " Clear from long press!");
state.performedLongPress(this);
res = true;
}
} catch (AbstractMethodError e) {
}
}
}
return res;
}
case ACTION_UP:
if (DEBUG) Log.v(TAG, "Key up to " + target + " in " + state
+ ": " + this);
if (state != null) {
state.handleUpEvent(this);
}
return receiver.onKeyUp(mKeyCode, this);
case ACTION_MULTIPLE:
final int count = mRepeatCount;
final int code = mKeyCode;
if (receiver.onKeyMultiple(code, count, this)) {
return true;
}
if (code != KeyEvent.KEYCODE_UNKNOWN) {
mAction = ACTION_DOWN;
mRepeatCount = 0;
boolean handled = receiver.onKeyDown(code, this);
if (handled) {
mAction = ACTION_UP;
receiver.onKeyUp(code, this);
}
mAction = ACTION_MULTIPLE;
mRepeatCount = count;
return handled;
}
return false;
}
return false;
|
public final int | getAction()Retrieve the action of this key event. May be either
{@link #ACTION_DOWN}, {@link #ACTION_UP}, or {@link #ACTION_MULTIPLE}.
return mAction;
|
public final java.lang.String | getCharacters()For the special case of a {@link #ACTION_MULTIPLE} event with key
code of {@link #KEYCODE_UNKNOWN}, this is a raw string of characters
associated with the event. In all other cases it is null.
return mCharacters;
|
public static int | getDeadChar(int accent, int c)Get the character that is produced by putting accent on the character
c.
For example, getDeadChar('`', 'e') returns è.
return KeyCharacterMap.getDeadChar(accent, c);
|
public final int | getDeviceId(){@inheritDoc}
return mDeviceId;
|
public char | getDisplayLabel()Gets the primary character for this key.
In other words, the label that is physically printed on it.
return getKeyCharacterMap().getDisplayLabel(mKeyCode);
|
public final long | getDownTime()Retrieve the time of the most recent key down event,
in the {@link android.os.SystemClock#uptimeMillis} time base. If this
is a down event, this will be the same as {@link #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 mDownTime;
|
public final long | getEventTime()Retrieve the time this event occurred,
in the {@link android.os.SystemClock#uptimeMillis} time base.
return mEventTime;
|
public final long | getEventTimeNano()Retrieve the time this event occurred,
in the {@link android.os.SystemClock#uptimeMillis} time base but with
nanosecond (instead of millisecond) precision.
The value is in nanosecond precision but it may not have nanosecond accuracy.
return mEventTime * 1000000L;
|
public final int | getFlags()Returns the flags for this key event.
return mFlags;
|
public final android.view.KeyCharacterMap | getKeyCharacterMap()Gets the {@link KeyCharacterMap} associated with the keyboard device.
return KeyCharacterMap.load(mDeviceId);
|
public final int | getKeyCode()Retrieve the key code of the key event. This is the physical key that
was pressed, not the Unicode character.
return mKeyCode;
|
public boolean | getKeyData(android.view.KeyCharacterMap.KeyData results)Get the character conversion data for a given key code.
return getKeyCharacterMap().getKeyData(mKeyCode, results);
|
public final int | getKeyboardDevice()Renamed to {@link #getDeviceId}.
return mDeviceId;
|
public char | getMatch(char[] chars)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
{@link #getMatch(char[],int) getMatch(chars, 0)}.
return getMatch(chars, 0);
|
public char | getMatch(char[] chars, int metaState)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.
return getKeyCharacterMap().getMatch(mKeyCode, chars, metaState);
|
public static int | getMaxKeyCode()Returns the maximum keycode.
return LAST_KEYCODE;
|
public final int | getMetaState()Returns the state of the meta keys.
return mMetaState;
|
public static int | getModifierMetaStateMask()Gets a mask that includes all valid modifier key meta state bits.
For the purposes of this function, {@link #KEYCODE_CAPS_LOCK},
{@link #KEYCODE_SCROLL_LOCK}, and {@link #KEYCODE_NUM_LOCK} are
not considered modifier keys. Consequently, the mask specifically excludes
{@link #META_CAPS_LOCK_ON}, {@link #META_SCROLL_LOCK_ON} and {@link #META_NUM_LOCK_ON}.
return META_MODIFIER_MASK;
|
public final int | getModifiers()Returns the state of the modifier keys.
For the purposes of this function, {@link #KEYCODE_CAPS_LOCK},
{@link #KEYCODE_SCROLL_LOCK}, and {@link #KEYCODE_NUM_LOCK} are
not considered modifier keys. Consequently, this function specifically masks out
{@link #META_CAPS_LOCK_ON}, {@link #META_SCROLL_LOCK_ON} and {@link #META_NUM_LOCK_ON}.
The value returned consists of the meta state (from {@link #getMetaState})
normalized using {@link #normalizeMetaState(int)} and then masked with
{@link #getModifierMetaStateMask} so that only valid modifier bits are retained.
return normalizeMetaState(mMetaState) & META_MODIFIER_MASK;
|
public char | getNumber()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 {@link #getNumber} is called with {@link KeyEvent#KEYCODE_Q} it returns '1'
so that the user can type numbers without pressing ALT when it makes sense.
return getKeyCharacterMap().getNumber(mKeyCode);
|
public final int | getRepeatCount()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.
return mRepeatCount;
|
public final int | getScanCode()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.
return mScanCode;
|
public final int | getSource(){@inheritDoc}
return mSource;
|
public int | getUnicodeChar()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 {@link MetaKeyKeyListener})
were active.
Returns 0 if the key is not one that is used to type Unicode
characters.
If the return value has bit {@link KeyCharacterMap#COMBINING_ACCENT} set, the
key is a "dead key" that should be combined with another to
actually produce a character -- see {@link KeyCharacterMap#getDeadChar} --
after masking with {@link KeyCharacterMap#COMBINING_ACCENT_MASK}.
return getUnicodeChar(mMetaState);
|
public int | getUnicodeChar(int metaState)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 {@link MetaKeyKeyListener})
were active.
Returns 0 if the key is not one that is used to type Unicode
characters.
If the return value has bit {@link KeyCharacterMap#COMBINING_ACCENT} set, the
key is a "dead key" that should be combined with another to
actually produce a character -- see {@link KeyCharacterMap#getDeadChar} --
after masking with {@link KeyCharacterMap#COMBINING_ACCENT_MASK}.
return getKeyCharacterMap().get(mKeyCode, metaState);
|
public final boolean | hasModifiers(int modifiers)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, {@link #KEYCODE_CAPS_LOCK},
{@link #KEYCODE_SCROLL_LOCK}, and {@link #KEYCODE_NUM_LOCK} are
not considered modifier keys. Consequently, this function ignores
{@link #META_CAPS_LOCK_ON}, {@link #META_SCROLL_LOCK_ON} and {@link #META_NUM_LOCK_ON}.
If the specified modifier mask includes directional modifiers, such as
{@link #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
{@link #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 {@link #META_SHIFT_ON} and {@link #META_SHIFT_LEFT_ON},
then this method throws an illegal argument exception.
return metaStateHasModifiers(mMetaState, modifiers);
|
public final boolean | hasNoModifiers()Returns true if no modifier keys are pressed.
For the purposes of this function, {@link #KEYCODE_CAPS_LOCK},
{@link #KEYCODE_SCROLL_LOCK}, and {@link #KEYCODE_NUM_LOCK} are
not considered modifier keys. Consequently, this function ignores
{@link #META_CAPS_LOCK_ON}, {@link #META_SCROLL_LOCK_ON} and {@link #META_NUM_LOCK_ON}.
The meta state is normalized prior to comparison using {@link #normalizeMetaState(int)}.
return metaStateHasNoModifiers(mMetaState);
|
public final boolean | isAltPressed()Returns the pressed state of the ALT meta key.
return (mMetaState & META_ALT_ON) != 0;
|
public final boolean | isCanceled()For {@link #ACTION_UP} events, indicates that the event has been
canceled as per {@link #FLAG_CANCELED}.
return (mFlags&FLAG_CANCELED) != 0;
|
public final boolean | isCapsLockOn()Returns the locked state of the CAPS LOCK meta key.
return (mMetaState & META_CAPS_LOCK_ON) != 0;
|
public static final boolean | isConfirmKey(int keyCode)Whether key will, by default, trigger a click on the focused view.
switch (keyCode) {
case KeyEvent.KEYCODE_DPAD_CENTER:
case KeyEvent.KEYCODE_ENTER:
return true;
default:
return false;
}
|
public final boolean | isCtrlPressed()Returns the pressed state of the CTRL meta key.
return (mMetaState & META_CTRL_ON) != 0;
|
public final boolean | isDown()Don't use in new code, instead explicitly check
{@link #getAction()}.
return mAction == ACTION_DOWN;
|
public final boolean | isFunctionPressed()Returns the pressed state of the FUNCTION meta key.
return (mMetaState & META_FUNCTION_ON) != 0;
|
public static final boolean | isGamepadButton(int keyCode)Returns true if the specified keycode is a gamepad button.
switch (keyCode) {
case KeyEvent.KEYCODE_BUTTON_A:
case KeyEvent.KEYCODE_BUTTON_B:
case KeyEvent.KEYCODE_BUTTON_C:
case KeyEvent.KEYCODE_BUTTON_X:
case KeyEvent.KEYCODE_BUTTON_Y:
case KeyEvent.KEYCODE_BUTTON_Z:
case KeyEvent.KEYCODE_BUTTON_L1:
case KeyEvent.KEYCODE_BUTTON_R1:
case KeyEvent.KEYCODE_BUTTON_L2:
case KeyEvent.KEYCODE_BUTTON_R2:
case KeyEvent.KEYCODE_BUTTON_THUMBL:
case KeyEvent.KEYCODE_BUTTON_THUMBR:
case KeyEvent.KEYCODE_BUTTON_START:
case KeyEvent.KEYCODE_BUTTON_SELECT:
case KeyEvent.KEYCODE_BUTTON_MODE:
case KeyEvent.KEYCODE_BUTTON_1:
case KeyEvent.KEYCODE_BUTTON_2:
case KeyEvent.KEYCODE_BUTTON_3:
case KeyEvent.KEYCODE_BUTTON_4:
case KeyEvent.KEYCODE_BUTTON_5:
case KeyEvent.KEYCODE_BUTTON_6:
case KeyEvent.KEYCODE_BUTTON_7:
case KeyEvent.KEYCODE_BUTTON_8:
case KeyEvent.KEYCODE_BUTTON_9:
case KeyEvent.KEYCODE_BUTTON_10:
case KeyEvent.KEYCODE_BUTTON_11:
case KeyEvent.KEYCODE_BUTTON_12:
case KeyEvent.KEYCODE_BUTTON_13:
case KeyEvent.KEYCODE_BUTTON_14:
case KeyEvent.KEYCODE_BUTTON_15:
case KeyEvent.KEYCODE_BUTTON_16:
return true;
default:
return false;
}
|
public final boolean | isLongPress()For {@link #ACTION_DOWN} events, indicates that the event has been
canceled as per {@link #FLAG_LONG_PRESS}.
return (mFlags&FLAG_LONG_PRESS) != 0;
|
public static final boolean | isMediaKey(int keyCode)Whether this key is a media key, which can be send to apps that are
interested in media key events.
switch (keyCode) {
case KeyEvent.KEYCODE_MEDIA_PLAY:
case KeyEvent.KEYCODE_MEDIA_PAUSE:
case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
case KeyEvent.KEYCODE_MUTE:
case KeyEvent.KEYCODE_HEADSETHOOK:
case KeyEvent.KEYCODE_MEDIA_STOP:
case KeyEvent.KEYCODE_MEDIA_NEXT:
case KeyEvent.KEYCODE_MEDIA_PREVIOUS:
case KeyEvent.KEYCODE_MEDIA_REWIND:
case KeyEvent.KEYCODE_MEDIA_RECORD:
case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD:
return true;
}
return false;
|
public static final boolean | isMetaKey(int keyCode)
return keyCode == KeyEvent.KEYCODE_META_LEFT || keyCode == KeyEvent.KEYCODE_META_RIGHT;
|
public final boolean | isMetaPressed()Returns the pressed state of the META meta key.
return (mMetaState & META_META_ON) != 0;
|
public static boolean | isModifierKey(int keyCode)Returns true if this key code is a modifier key.
For the purposes of this function, {@link #KEYCODE_CAPS_LOCK},
{@link #KEYCODE_SCROLL_LOCK}, and {@link #KEYCODE_NUM_LOCK} are
not considered modifier keys. Consequently, this function return false
for those keys.
switch (keyCode) {
case KEYCODE_SHIFT_LEFT:
case KEYCODE_SHIFT_RIGHT:
case KEYCODE_ALT_LEFT:
case KEYCODE_ALT_RIGHT:
case KEYCODE_CTRL_LEFT:
case KEYCODE_CTRL_RIGHT:
case KEYCODE_META_LEFT:
case KEYCODE_META_RIGHT:
case KEYCODE_SYM:
case KEYCODE_NUM:
case KEYCODE_FUNCTION:
return true;
default:
return false;
}
|
public final boolean | isNumLockOn()Returns the locked state of the NUM LOCK meta key.
return (mMetaState & META_NUM_LOCK_ON) != 0;
|
public boolean | isPrintingKey()Returns true if this key produces a glyph.
return getKeyCharacterMap().isPrintingKey(mKeyCode);
|
public final boolean | isScrollLockOn()Returns the locked state of the SCROLL LOCK meta key.
return (mMetaState & META_SCROLL_LOCK_ON) != 0;
|
public final boolean | isShiftPressed()Returns the pressed state of the SHIFT meta key.
return (mMetaState & META_SHIFT_ON) != 0;
|
public final boolean | isSymPressed()Returns the pressed state of the SYM meta key.
return (mMetaState & META_SYM_ON) != 0;
|
public final boolean | isSystem()Is this a system key? System keys can not be used for menu shortcuts.
return isSystemKey(mKeyCode);
|
public static final boolean | isSystemKey(int keyCode)Is this a system key? System keys can not be used for menu shortcuts.
switch (keyCode) {
case KeyEvent.KEYCODE_MENU:
case KeyEvent.KEYCODE_SOFT_RIGHT:
case KeyEvent.KEYCODE_HOME:
case KeyEvent.KEYCODE_BACK:
case KeyEvent.KEYCODE_CALL:
case KeyEvent.KEYCODE_ENDCALL:
case KeyEvent.KEYCODE_VOLUME_UP:
case KeyEvent.KEYCODE_VOLUME_DOWN:
case KeyEvent.KEYCODE_VOLUME_MUTE:
case KeyEvent.KEYCODE_MUTE:
case KeyEvent.KEYCODE_POWER:
case KeyEvent.KEYCODE_HEADSETHOOK:
case KeyEvent.KEYCODE_MEDIA_PLAY:
case KeyEvent.KEYCODE_MEDIA_PAUSE:
case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
case KeyEvent.KEYCODE_MEDIA_STOP:
case KeyEvent.KEYCODE_MEDIA_NEXT:
case KeyEvent.KEYCODE_MEDIA_PREVIOUS:
case KeyEvent.KEYCODE_MEDIA_REWIND:
case KeyEvent.KEYCODE_MEDIA_RECORD:
case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD:
case KeyEvent.KEYCODE_CAMERA:
case KeyEvent.KEYCODE_FOCUS:
case KeyEvent.KEYCODE_SEARCH:
case KeyEvent.KEYCODE_BRIGHTNESS_DOWN:
case KeyEvent.KEYCODE_BRIGHTNESS_UP:
case KeyEvent.KEYCODE_MEDIA_AUDIO_TRACK:
return true;
}
return false;
|
public final boolean | isTainted()
return (mFlags & FLAG_TAINTED) != 0;
|
public final boolean | isTracking()For {@link #ACTION_UP} events, indicates that the event is still being
tracked from its initial down event as per
{@link #FLAG_TRACKING}.
return (mFlags&FLAG_TRACKING) != 0;
|
public final boolean | isWakeKey()
return isWakeKey(mKeyCode);
|
public static final boolean | isWakeKey(int keyCode)
switch (keyCode) {
case KeyEvent.KEYCODE_BACK:
case KeyEvent.KEYCODE_POWER:
case KeyEvent.KEYCODE_MENU:
case KeyEvent.KEYCODE_SLEEP:
case KeyEvent.KEYCODE_WAKEUP:
case KeyEvent.KEYCODE_PAIRING:
return true;
}
return false;
|
public static int | keyCodeFromString(java.lang.String symbolicName)Gets a keycode by its symbolic name such as "KEYCODE_A" or an equivalent
numeric constant such as "1001".
if (symbolicName.startsWith(LABEL_PREFIX)) {
symbolicName = symbolicName.substring(LABEL_PREFIX.length());
int keyCode = nativeKeyCodeFromString(symbolicName);
if (keyCode > 0) {
return keyCode;
}
}
try {
return Integer.parseInt(symbolicName, 10);
} catch (NumberFormatException ex) {
return KEYCODE_UNKNOWN;
}
|
public static java.lang.String | keyCodeToString(int keyCode)Returns a string that represents the symbolic name of the specified keycode
such as "KEYCODE_A", "KEYCODE_DPAD_UP", or an equivalent numeric constant
such as "1001" if unknown.
String symbolicName = nativeKeyCodeToString(keyCode);
return symbolicName != null ? LABEL_PREFIX + symbolicName : Integer.toString(keyCode);
|
private static int | metaStateFilterDirectionalModifiers(int metaState, int modifiers, int basic, int left, int right)
final boolean wantBasic = (modifiers & basic) != 0;
final int directional = left | right;
final boolean wantLeftOrRight = (modifiers & directional) != 0;
if (wantBasic) {
if (wantLeftOrRight) {
throw new IllegalArgumentException("modifiers must not contain "
+ metaStateToString(basic) + " combined with "
+ metaStateToString(left) + " or " + metaStateToString(right));
}
return metaState & ~directional;
} else if (wantLeftOrRight) {
return metaState & ~basic;
} else {
return metaState;
}
|
public static boolean | metaStateHasModifiers(int metaState, int modifiers)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, {@link #KEYCODE_CAPS_LOCK},
{@link #KEYCODE_SCROLL_LOCK}, and {@link #KEYCODE_NUM_LOCK} are
not considered modifier keys. Consequently, this function ignores
{@link #META_CAPS_LOCK_ON}, {@link #META_SCROLL_LOCK_ON} and {@link #META_NUM_LOCK_ON}.
If the specified modifier mask includes directional modifiers, such as
{@link #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
{@link #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 {@link #META_SHIFT_ON} and {@link #META_SHIFT_LEFT_ON},
then this method throws an illegal argument exception.
// Note: For forward compatibility, we allow the parameter to contain meta states
// that we do not recognize but we explicitly disallow meta states that
// are not valid modifiers.
if ((modifiers & META_INVALID_MODIFIER_MASK) != 0) {
throw new IllegalArgumentException("modifiers must not contain "
+ "META_CAPS_LOCK_ON, META_NUM_LOCK_ON, META_SCROLL_LOCK_ON, "
+ "META_CAP_LOCKED, META_ALT_LOCKED, META_SYM_LOCKED, "
+ "or META_SELECTING");
}
metaState = normalizeMetaState(metaState) & META_MODIFIER_MASK;
metaState = metaStateFilterDirectionalModifiers(metaState, modifiers,
META_SHIFT_ON, META_SHIFT_LEFT_ON, META_SHIFT_RIGHT_ON);
metaState = metaStateFilterDirectionalModifiers(metaState, modifiers,
META_ALT_ON, META_ALT_LEFT_ON, META_ALT_RIGHT_ON);
metaState = metaStateFilterDirectionalModifiers(metaState, modifiers,
META_CTRL_ON, META_CTRL_LEFT_ON, META_CTRL_RIGHT_ON);
metaState = metaStateFilterDirectionalModifiers(metaState, modifiers,
META_META_ON, META_META_LEFT_ON, META_META_RIGHT_ON);
return metaState == modifiers;
|
public static boolean | metaStateHasNoModifiers(int metaState)Returns true if no modifiers keys are pressed according to the specified meta state.
For the purposes of this function, {@link #KEYCODE_CAPS_LOCK},
{@link #KEYCODE_SCROLL_LOCK}, and {@link #KEYCODE_NUM_LOCK} are
not considered modifier keys. Consequently, this function ignores
{@link #META_CAPS_LOCK_ON}, {@link #META_SCROLL_LOCK_ON} and {@link #META_NUM_LOCK_ON}.
The meta state is normalized prior to comparison using {@link #normalizeMetaState(int)}.
return (normalizeMetaState(metaState) & META_MODIFIER_MASK) == 0;
|
public static java.lang.String | metaStateToString(int metaState)Returns a string that represents the symbolic name of the specified combined meta
key modifier state flags such as "0", "META_SHIFT_ON",
"META_ALT_ON|META_SHIFT_ON" or an equivalent numeric constant such as "0x10000000"
if unknown.
if (metaState == 0) {
return "0";
}
StringBuilder result = null;
int i = 0;
while (metaState != 0) {
final boolean isSet = (metaState & 1) != 0;
metaState >>>= 1; // unsigned shift!
if (isSet) {
final String name = META_SYMBOLIC_NAMES[i];
if (result == null) {
if (metaState == 0) {
return name;
}
result = new StringBuilder(name);
} else {
result.append('|");
result.append(name);
}
}
i += 1;
}
return result.toString();
|
private static native int | nativeKeyCodeFromString(java.lang.String keyCode)
|
private static native java.lang.String | nativeKeyCodeToString(int keyCode)
|
public static int | normalizeMetaState(int metaState)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 {@link #META_ALT_LEFT_ON} then
the result will also contain {@link #META_ALT_ON} in addition to {@link #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
{@link MetaKeyKeyListener}, then those states are translated here and the original
synthetic meta states are removed from the result.
{@link MetaKeyKeyListener#META_CAP_LOCKED} is translated to {@link #META_CAPS_LOCK_ON}.
{@link MetaKeyKeyListener#META_ALT_LOCKED} is translated to {@link #META_ALT_ON}.
{@link MetaKeyKeyListener#META_SYM_LOCKED} is translated to {@link #META_SYM_ON}.
Undefined meta state bits are removed.
if ((metaState & (META_SHIFT_LEFT_ON | META_SHIFT_RIGHT_ON)) != 0) {
metaState |= META_SHIFT_ON;
}
if ((metaState & (META_ALT_LEFT_ON | META_ALT_RIGHT_ON)) != 0) {
metaState |= META_ALT_ON;
}
if ((metaState & (META_CTRL_LEFT_ON | META_CTRL_RIGHT_ON)) != 0) {
metaState |= META_CTRL_ON;
}
if ((metaState & (META_META_LEFT_ON | META_META_RIGHT_ON)) != 0) {
metaState |= META_META_ON;
}
if ((metaState & MetaKeyKeyListener.META_CAP_LOCKED) != 0) {
metaState |= META_CAPS_LOCK_ON;
}
if ((metaState & MetaKeyKeyListener.META_ALT_LOCKED) != 0) {
metaState |= META_ALT_ON;
}
if ((metaState & MetaKeyKeyListener.META_SYM_LOCKED) != 0) {
metaState |= META_SYM_ON;
}
return metaState & META_ALL_MASK;
|
private static android.view.KeyEvent | obtain()
final KeyEvent ev;
synchronized (gRecyclerLock) {
ev = gRecyclerTop;
if (ev == null) {
return new KeyEvent();
}
gRecyclerTop = ev.mNext;
gRecyclerUsed -= 1;
}
ev.mNext = null;
ev.prepareForReuse();
return ev;
|
public static android.view.KeyEvent | obtain(long downTime, long eventTime, int action, int code, int repeat, int metaState, int deviceId, int scancode, int flags, int source, java.lang.String characters)Obtains a (potentially recycled) key event.
KeyEvent ev = obtain();
ev.mDownTime = downTime;
ev.mEventTime = eventTime;
ev.mAction = action;
ev.mKeyCode = code;
ev.mRepeatCount = repeat;
ev.mMetaState = metaState;
ev.mDeviceId = deviceId;
ev.mScanCode = scancode;
ev.mFlags = flags;
ev.mSource = source;
ev.mCharacters = characters;
return ev;
|
public static android.view.KeyEvent | obtain(android.view.KeyEvent other)Obtains a (potentially recycled) copy of another key event.
KeyEvent ev = obtain();
ev.mDownTime = other.mDownTime;
ev.mEventTime = other.mEventTime;
ev.mAction = other.mAction;
ev.mKeyCode = other.mKeyCode;
ev.mRepeatCount = other.mRepeatCount;
ev.mMetaState = other.mMetaState;
ev.mDeviceId = other.mDeviceId;
ev.mScanCode = other.mScanCode;
ev.mFlags = other.mFlags;
ev.mSource = other.mSource;
ev.mCharacters = other.mCharacters;
return ev;
|
public final void | recycle()Recycles a key event.
Key events should only be recycled if they are owned by the system since user
code expects them to be essentially immutable, "tracking" notwithstanding.
super.recycle();
mCharacters = null;
synchronized (gRecyclerLock) {
if (gRecyclerUsed < MAX_RECYCLED) {
gRecyclerUsed++;
mNext = gRecyclerTop;
gRecyclerTop = this;
}
}
|
public final void | recycleIfNeededAfterDispatch()
// Do nothing.
|
public final void | setSource(int source){@inheritDoc}
mSource = source;
|
public final void | setTainted(boolean tainted)
mFlags = tainted ? mFlags | FLAG_TAINTED : mFlags & ~FLAG_TAINTED;
|
public final void | startTracking()Call this during {@link 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.
mFlags |= FLAG_START_TRACKING;
|
public java.lang.String | toString()
StringBuilder msg = new StringBuilder();
msg.append("KeyEvent { action=").append(actionToString(mAction));
msg.append(", keyCode=").append(keyCodeToString(mKeyCode));
msg.append(", scanCode=").append(mScanCode);
if (mCharacters != null) {
msg.append(", characters=\"").append(mCharacters).append("\"");
}
msg.append(", metaState=").append(metaStateToString(mMetaState));
msg.append(", flags=0x").append(Integer.toHexString(mFlags));
msg.append(", repeatCount=").append(mRepeatCount);
msg.append(", eventTime=").append(mEventTime);
msg.append(", downTime=").append(mDownTime);
msg.append(", deviceId=").append(mDeviceId);
msg.append(", source=0x").append(Integer.toHexString(mSource));
msg.append(" }");
return msg.toString();
|
public void | writeToParcel(android.os.Parcel out, int flags)
out.writeInt(PARCEL_TOKEN_KEY_EVENT);
out.writeInt(mDeviceId);
out.writeInt(mSource);
out.writeInt(mAction);
out.writeInt(mKeyCode);
out.writeInt(mRepeatCount);
out.writeInt(mMetaState);
out.writeInt(mScanCode);
out.writeInt(mFlags);
out.writeLong(mDownTime);
out.writeLong(mEventTime);
|