Skip to content

Most visited

Recently visited

navigation
added in version 22.0.0
Deprecated since API level 26.0.0

KeyEventCompat

public final class KeyEventCompat
extends Object

java.lang.Object
   ↳ android.support.v4.view.KeyEventCompat


This class was deprecated in API level 26.0.0.
Use KeyEvent directly.

Helper for accessing features in KeyEvent.

Summary

Public methods

static boolean dispatch(KeyEvent event, KeyEvent.Callback receiver, Object state, Object target)

This method was deprecated in API level 24.2.0. Call dispatch(KeyEvent.Callback, KeyEvent.DispatcherState, Object) directly. This method will be removed in a future release.

static Object getKeyDispatcherState(View view)

This method was deprecated in API level 24.2.0. Call getKeyDispatcherState() directly. This method will be removed in a future release.

static boolean hasModifiers(KeyEvent event, int modifiers)

This method was deprecated in API level 26.0.0. Call hasModifiers(int) directly. This method will be removed in a future release.

static boolean hasNoModifiers(KeyEvent event)

This method was deprecated in API level 26.0.0. Call hasNoModifiers() directly. This method will be removed in a future release.

static boolean isCtrlPressed(KeyEvent event)

This method was deprecated in API level 26.0.0. Call isCtrlPressed() directly. This method will be removed in a future release.

static boolean isTracking(KeyEvent event)

This method was deprecated in API level 24.2.0. Call isTracking() directly. This method will be removed in a future release.

static boolean metaStateHasModifiers(int metaState, int modifiers)

This method was deprecated in API level 26.0.0. Call metaStateHasModifiers(int, int) directly. This method will be removed in a future release.

static boolean metaStateHasNoModifiers(int metaState)

This method was deprecated in API level 26.0.0. Call metaStateHasNoModifiers(int) directly. This method will be removed in a future release.

static int normalizeMetaState(int metaState)

This method was deprecated in API level 26.0.0. Call normalizeMetaState(int) directly. This method will be removed in a future release.

static void startTracking(KeyEvent event)

This method was deprecated in API level 24.2.0. Call startTracking() directly. This method will be removed in a future release.

Inherited methods

From class java.lang.Object

Public methods

dispatch

added in version 22.0.0
boolean dispatch (KeyEvent event, 
                KeyEvent.Callback receiver, 
                Object state, 
                Object target)

This method was deprecated in API level 24.2.0.
Call dispatch(KeyEvent.Callback, KeyEvent.DispatcherState, Object) directly. This method will be removed in a future release.

Parameters
event KeyEvent

receiver KeyEvent.Callback

state Object

target Object

Returns
boolean

getKeyDispatcherState

added in version 22.0.0
Object getKeyDispatcherState (View view)

This method was deprecated in API level 24.2.0.
Call getKeyDispatcherState() directly. This method will be removed in a future release.

Parameters
view View

Returns
Object

hasModifiers

added in version 22.0.0
boolean hasModifiers (KeyEvent event, 
                int modifiers)

This method was deprecated in API level 26.0.0.
Call hasModifiers(int) directly. This method will be removed in a future release.

Parameters
event KeyEvent

modifiers int

Returns
boolean

hasNoModifiers

added in version 22.0.0
boolean hasNoModifiers (KeyEvent event)

This method was deprecated in API level 26.0.0.
Call hasNoModifiers() directly. This method will be removed in a future release.

Parameters
event KeyEvent

Returns
boolean

isCtrlPressed

added in version 24.0.0
boolean isCtrlPressed (KeyEvent event)

This method was deprecated in API level 26.0.0.
Call isCtrlPressed() directly. This method will be removed in a future release.

Parameters
event KeyEvent

Returns
boolean

isTracking

added in version 22.0.0
boolean isTracking (KeyEvent event)

This method was deprecated in API level 24.2.0.
Call isTracking() directly. This method will be removed in a future release.

Parameters
event KeyEvent

Returns
boolean

metaStateHasModifiers

added in version 22.0.0
boolean metaStateHasModifiers (int metaState, 
                int modifiers)

This method was deprecated in API level 26.0.0.
Call metaStateHasModifiers(int, int) directly. This method will be removed in a future release.

Parameters
metaState int

modifiers int

Returns
boolean

metaStateHasNoModifiers

added in version 22.0.0
boolean metaStateHasNoModifiers (int metaState)

This method was deprecated in API level 26.0.0.
Call metaStateHasNoModifiers(int) directly. This method will be removed in a future release.

Parameters
metaState int

Returns
boolean

normalizeMetaState

added in version 22.0.0
int normalizeMetaState (int metaState)

This method was deprecated in API level 26.0.0.
Call normalizeMetaState(int) directly. This method will be removed in a future release.

Parameters
metaState int

Returns
int

startTracking

added in version 22.0.0
void startTracking (KeyEvent event)

This method was deprecated in API level 24.2.0.
Call startTracking() directly. This method will be removed in a future release.

Parameters
event KeyEvent

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)