Added in API level 9

InputEvent


abstract class InputEvent : Parcelable
kotlin.Any
   ↳ android.view.InputEvent

Common base class for input events.

Summary

Inherited constants
Public methods
open Int

InputDevice!

Gets the device that this event came from.

abstract Int

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

abstract Long

Retrieve the time this event occurred, in the android.os.SystemClock#uptimeMillis time base.

abstract Int

Gets the source of the event.

open Boolean
isFromSource(source: Int)

Determines whether the event is from the given source.

Inherited functions
Properties
static Parcelable.Creator<InputEvent!>

Public methods

describeContents

Added in API level 9
open fun describeContents(): Int
Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR

getDevice

Added in API level 9
fun getDevice(): InputDevice!

Gets the device that this event came from.

Return
InputDevice! The device, or null if unknown.

getDeviceId

Added in API level 9
abstract fun getDeviceId(): Int

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.

Return
Int The device id.

getEventTime

Added in API level 16
abstract fun getEventTime(): Long

Retrieve the time this event occurred, in the android.os.SystemClock#uptimeMillis time base.

Return
Long Returns the time this event occurred, in the android.os.SystemClock#uptimeMillis time base.

getSource

Added in API level 9
abstract fun getSource(): Int

Gets the source of the event.

Return
Int The event source or InputDevice#SOURCE_UNKNOWN if unknown.

isFromSource

Added in API level 18
open fun isFromSource(source: Int): Boolean

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 InputDevice#SOURCE_TOUCH_NAVIGATION, or a more generic device class, such as InputDevice#SOURCE_CLASS_POINTER.
Return
Boolean Whether the event is from the given source.

Properties

CREATOR

Added in API level 9
static val CREATOR: Parcelable.Creator<InputEvent!>