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 |
| 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
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
fun getDevice(): InputDevice!
Gets the device that this event came from.
| Return | |
|---|---|
InputDevice! |
The device, or null if unknown. |
getDeviceId
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. |
See Also
getEventTime
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
abstract fun getSource(): Int
Gets the source of the event.
| Return | |
|---|---|
Int |
The event source or InputDevice.SOURCE_UNKNOWN if unknown. |
See Also
isFromSource
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. |