Added in API level 9

MotionRange


class MotionRange
kotlin.Any
   ↳ android.view.InputDevice.MotionRange

Provides information about the range of values for a particular MotionEvent axis.

Summary

Public methods
Int

Gets the axis id.

Float

Gets the extent of the center flat position with respect to this axis.

Float

Gets the error tolerance for input device measurements with respect to this axis.

Float

Gets the inclusive maximum value for the axis.

Float

Gets the inclusive minimum value for the axis.

Float

Gets the range of the axis (difference between maximum and minimum).

Float

Gets the resolution for input device measurements with respect to this axis.

Int

Gets the source for which the axis is defined.

Boolean
isFromSource(source: Int)

Determines whether the event is from the given source.

Public methods

getAxis

Added in API level 12
fun getAxis(): Int

Gets the axis id.

Return
Int The axis id.

getFlat

Added in API level 9
fun getFlat(): Float

Gets the extent of the center flat position with respect to this axis.

For example, a flat value of 8 means that the center position is between -8 and +8. This value is mainly useful for calibrating self-centering devices.

Return
Float The extent of the center flat position.

getFuzz

Added in API level 9
fun getFuzz(): Float

Gets the error tolerance for input device measurements with respect to this axis.

For example, a value of 2 indicates that the measured value may be up to +/- 2 units away from the actual value due to noise and device sensitivity limitations.

Return
Float The error tolerance.

getMax

Added in API level 9
fun getMax(): Float

Gets the inclusive maximum value for the axis.

Return
Float The inclusive maximum value.

getMin

Added in API level 9
fun getMin(): Float

Gets the inclusive minimum value for the axis.

Return
Float The inclusive minimum value.

getRange

Added in API level 9
fun getRange(): Float

Gets the range of the axis (difference between maximum and minimum).

Return
Float The range of values.

getResolution

Added in API level 18
fun getResolution(): Float

Gets the resolution for input device measurements with respect to this axis.

Return
Float The resolution in units per millimeter, or units per radian for rotational axes.

getSource

Added in API level 12
fun getSource(): Int

Gets the source for which the axis is defined.

Return
Int The source.

isFromSource

Added in API level 18
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.