Skip to content

Most visited

Recently visited

navigation
Added in API level 9

InputEvent

public abstract class InputEvent
extends Object implements Parcelable

java.lang.Object
   ↳ android.view.InputEvent
Known Direct Subclasses


Common base class for input events.

Summary

Inherited constants

From interface android.os.Parcelable

Fields

public static final Creator<InputEvent> CREATOR

Public methods

int describeContents()

Describe the kinds of special objects contained in this Parcelable's marshalled representation.

final InputDevice getDevice()

Gets the device that this event came from.

abstract int getDeviceId()

Gets the id for the device that this event came from.

abstract long getEventTime()

Retrieve the time this event occurred, in the uptimeMillis() time base.

abstract int getSource()

Gets the source of the event.

boolean isFromSource(int source)

Determines whether the event is from the given source.

Inherited methods

From class java.lang.Object
From interface android.os.Parcelable

Fields

CREATOR

Added in API level 9
Creator<InputEvent> CREATOR

Public methods

describeContents

Added in API level 1
int describeContents ()

Describe the kinds of special objects contained in this Parcelable's marshalled representation.

Returns
int a bitmask indicating the set of special object types marshalled by the Parcelable.

getDevice

Added in API level 9
InputDevice getDevice ()

Gets the device that this event came from.

Returns
InputDevice The device, or null if unknown.

getDeviceId

Added in API level 9
int getDeviceId ()

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.

Returns
int The device id.

See also:

getEventTime

Added in API level 16
long getEventTime ()

Retrieve the time this event occurred, in the uptimeMillis() time base.

Returns
long Returns the time this event occurred, in the uptimeMillis() time base.

getSource

Added in API level 9
int getSource ()

Gets the source of the event.

Returns
int The event source or SOURCE_UNKNOWN if unknown.

See also:

isFromSource

Added in API level 18
boolean isFromSource (int source)

Determines whether the event is from the given source.

Parameters
source int: The input source to check against. This can be a specific device type, such as SOURCE_TOUCH_NAVIGATION, or a more generic device class, such as SOURCE_CLASS_POINTER.
Returns
boolean Whether the event is from the given source.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

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.