Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)
Android APIs
public abstract class

InputEvent

extends Object
implements Parcelable
java.lang.Object
   ↳ android.view.InputEvent
Known Direct Subclasses

Class Overview

Common base class for input events.

Summary

[Expand]
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.
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Fields

public static final Creator < InputEvent > CREATOR

Added in API level 9

Public Methods

public int describeContents ()

Added in API level 1

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

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

public final InputDevice getDevice ()

Added in API level 9

Gets the device that this event came from.

Returns
  • The device, or null if unknown.

public abstract int getDeviceId ()

Added in API level 9

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
  • The device id.

public abstract long getEventTime ()

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

Returns

public abstract int getSource ()

Added in API level 9

Gets the source of the event.

Returns

public boolean isFromSource (int source)

Determines whether the event is from the given source.

Parameters
source 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
  • Whether the event is from the given source.