MotionEvent.Obtain Method

Definition

Overloads

Obtain(Int64, Int64, MotionEventActions, Int32, MotionEvent+PointerProperties[], MotionEvent+PointerCoords[], MetaKeyStates, MotionEventButtonState, Single, Single, Int32, Edge, InputSourceType, Int32, MotionEventFlags, ClassificationMode)
Obtain(Int64, Int64, MotionEventActions, Int32, MotionEvent+PointerProperties[], MotionEvent+PointerCoords[], MetaKeyStates, MotionEventButtonState, Single, Single, Int32, Edge, InputSourceType, MotionEventFlags)

Create a new MotionEvent, filling in all of the basic values that define the motion.

Obtain(Int64, Int64, Int32, Int32, Single, Single, Single, Single, MetaKeyStates, Single, Single, Int32, Edge)
Obtain(Int64, Int64, Int32, Int32, Int32[], MotionEvent+PointerCoords[], MetaKeyStates, Single, Single, Int32, Edge, Int32, Int32)
Obtain(Int64, Int64, MotionEventActions, Int32, Single, Single, Single, Single, MetaKeyStates, Single, Single, Int32, Edge)
Obsolete.

Create a new MotionEvent, filling in all of the basic values that define the motion.

Obtain(Int64, Int64, MotionEventActions, Int32, Int32[], MotionEvent+PointerCoords[], MetaKeyStates, Single, Single, Int32, Edge, InputSourceType, MotionEventFlags)
Obsolete.

Create a new MotionEvent, filling in all of the basic values that define the motion.

Obtain(Int64, Int64, Int32, Single, Single, Single, Single, MetaKeyStates, Single, Single, Int32, Edge)
Obtain(Int64, Int64, MotionEventActions, Single, Single, Single, Single, MetaKeyStates, Single, Single, Int32, Edge)

Create a new MotionEvent, filling in all of the basic values that define the motion.

Obtain(Int64, Int64, Int32, Single, Single, MetaKeyStates)
Obtain(Int64, Int64, MotionEventActions, Single, Single, MetaKeyStates)

Create a new MotionEvent, filling in a subset of the basic motion values.

Obtain(MotionEvent)

Create a new MotionEvent, copying from an existing one.

Obtain(Int64, Int64, MotionEventActions, Int32, MotionEvent+PointerProperties[], MotionEvent+PointerCoords[], MetaKeyStates, MotionEventButtonState, Single, Single, Int32, Edge, InputSourceType, Int32, MotionEventFlags, ClassificationMode)

[Android.Runtime.Register("obtain", "(JJII[Landroid/view/MotionEvent$PointerProperties;[Landroid/view/MotionEvent$PointerCoords;IIFFIIIIII)Landroid/view/MotionEvent;", "", ApiSince=34)]
public static Android.Views.MotionEvent? Obtain (long downTime, long eventTime, Android.Views.MotionEventActions action, int pointerCount, Android.Views.MotionEvent.PointerProperties[] pointerProperties, Android.Views.MotionEvent.PointerCoords[] pointerCoords, Android.Views.MetaKeyStates metaState, Android.Views.MotionEventButtonState buttonState, float xPrecision, float yPrecision, int deviceId, Android.Views.Edge edgeFlags, Android.Views.InputSourceType source, int displayId, Android.Views.MotionEventFlags flags, Android.Views.ClassificationMode classification);
[<Android.Runtime.Register("obtain", "(JJII[Landroid/view/MotionEvent$PointerProperties;[Landroid/view/MotionEvent$PointerCoords;IIFFIIIIII)Landroid/view/MotionEvent;", "", ApiSince=34)>]
static member Obtain : int64 * int64 * Android.Views.MotionEventActions * int * Android.Views.MotionEvent.PointerProperties[] * Android.Views.MotionEvent.PointerCoords[] * Android.Views.MetaKeyStates * Android.Views.MotionEventButtonState * single * single * int * Android.Views.Edge * Android.Views.InputSourceType * int * Android.Views.MotionEventFlags * Android.Views.ClassificationMode -> Android.Views.MotionEvent

Parameters

downTime
Int64
eventTime
Int64
pointerCount
Int32
pointerProperties
MotionEvent.PointerProperties[]
pointerCoords
MotionEvent.PointerCoords[]
metaState
MetaKeyStates
xPrecision
Single
yPrecision
Single
deviceId
Int32
edgeFlags
Edge
displayId
Int32
classification
ClassificationMode

Returns

Attributes

Applies to

Obtain(Int64, Int64, MotionEventActions, Int32, MotionEvent+PointerProperties[], MotionEvent+PointerCoords[], MetaKeyStates, MotionEventButtonState, Single, Single, Int32, Edge, InputSourceType, MotionEventFlags)

Create a new MotionEvent, filling in all of the basic values that define the motion.

[Android.Runtime.Register("obtain", "(JJII[Landroid/view/MotionEvent$PointerProperties;[Landroid/view/MotionEvent$PointerCoords;IIFFIIII)Landroid/view/MotionEvent;", "")]
public static Android.Views.MotionEvent? Obtain (long downTime, long eventTime, Android.Views.MotionEventActions action, int pointerCount, Android.Views.MotionEvent.PointerProperties[]? pointerProperties, Android.Views.MotionEvent.PointerCoords[]? pointerCoords, Android.Views.MetaKeyStates metaState, Android.Views.MotionEventButtonState buttonState, float xPrecision, float yPrecision, int deviceId, Android.Views.Edge edgeFlags, Android.Views.InputSourceType source, Android.Views.MotionEventFlags flags);
[<Android.Runtime.Register("obtain", "(JJII[Landroid/view/MotionEvent$PointerProperties;[Landroid/view/MotionEvent$PointerCoords;IIFFIIII)Landroid/view/MotionEvent;", "")>]
static member Obtain : int64 * int64 * Android.Views.MotionEventActions * int * Android.Views.MotionEvent.PointerProperties[] * Android.Views.MotionEvent.PointerCoords[] * Android.Views.MetaKeyStates * Android.Views.MotionEventButtonState * single * single * int * Android.Views.Edge * Android.Views.InputSourceType * Android.Views.MotionEventFlags -> Android.Views.MotionEvent

Parameters

downTime
Int64

The time (in ms) when the user originally pressed down to start a stream of position events. This must be obtained from SystemClock#uptimeMillis().

eventTime
Int64

The the time (in ms) when this specific event was generated. This must be obtained from SystemClock#uptimeMillis().

action
MotionEventActions

The kind of action being performed, such as #ACTION_DOWN.

pointerCount
Int32

The number of pointers that will be in this event.

pointerProperties
MotionEvent.PointerProperties[]

An array of pointerCount values providing a MotionEvent PointerProperties property object for each pointer, which must include the pointer identifier.

pointerCoords
MotionEvent.PointerCoords[]

An array of pointerCount values providing a MotionEvent PointerCoords coordinate object for each pointer.

metaState
MetaKeyStates

The state of any meta / modifier keys that were in effect when the event was generated.

buttonState
MotionEventButtonState

The state of buttons that are pressed.

xPrecision
Single

The precision of the X coordinate being reported.

yPrecision
Single

The precision of the Y coordinate being reported.

deviceId
Int32

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; other numbers are arbitrary and you shouldn't depend on the values.

edgeFlags
Edge

A bitfield indicating which edges, if any, were touched by this MotionEvent.

source
InputSourceType

The source of this event.

flags
MotionEventFlags

The motion event flags.

Returns

Attributes

Remarks

Java documentation for android.view.MotionEvent.obtain(long, long, int, float, float, float, float, int, float, float, int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Obtain(Int64, Int64, Int32, Int32, Single, Single, Single, Single, MetaKeyStates, Single, Single, Int32, Edge)

public static Android.Views.MotionEvent? Obtain (long downTime, long eventTime, int action, int pointers, float x, float y, float pressure, float size, Android.Views.MetaKeyStates metaState, float xPrecision, float yPrecision, int deviceId, Android.Views.Edge edgeFlags);
static member Obtain : int64 * int64 * int * int * single * single * single * single * Android.Views.MetaKeyStates * single * single * int * Android.Views.Edge -> Android.Views.MotionEvent

Parameters

downTime
Int64
eventTime
Int64
action
Int32
pointers
Int32
x
Single
y
Single
pressure
Single
size
Single
metaState
MetaKeyStates
xPrecision
Single
yPrecision
Single
deviceId
Int32
edgeFlags
Edge

Returns

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Obtain(Int64, Int64, Int32, Int32, Int32[], MotionEvent+PointerCoords[], MetaKeyStates, Single, Single, Int32, Edge, Int32, Int32)

public static Android.Views.MotionEvent? Obtain (long downTime, long eventTime, int action, int pointers, int[] pointerIds, Android.Views.MotionEvent.PointerCoords[] pointerCoords, Android.Views.MetaKeyStates metaState, float xPrecision, float yPrecision, int deviceId, Android.Views.Edge edgeFlags, int source, int flags);
static member Obtain : int64 * int64 * int * int * int[] * Android.Views.MotionEvent.PointerCoords[] * Android.Views.MetaKeyStates * single * single * int * Android.Views.Edge * int * int -> Android.Views.MotionEvent

Parameters

downTime
Int64
eventTime
Int64
action
Int32
pointers
Int32
pointerIds
Int32[]
pointerCoords
MotionEvent.PointerCoords[]
metaState
MetaKeyStates
xPrecision
Single
yPrecision
Single
deviceId
Int32
edgeFlags
Edge
source
Int32
flags
Int32

Returns

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Obtain(Int64, Int64, MotionEventActions, Int32, Single, Single, Single, Single, MetaKeyStates, Single, Single, Int32, Edge)

Caution

deprecated

Create a new MotionEvent, filling in all of the basic values that define the motion.

[Android.Runtime.Register("obtain", "(JJIIFFFFIFFII)Landroid/view/MotionEvent;", "")]
[System.Obsolete("deprecated")]
public static Android.Views.MotionEvent? Obtain (long downTime, long eventTime, Android.Views.MotionEventActions action, int pointerCount, float x, float y, float pressure, float size, Android.Views.MetaKeyStates metaState, float xPrecision, float yPrecision, int deviceId, Android.Views.Edge edgeFlags);
[<Android.Runtime.Register("obtain", "(JJIIFFFFIFFII)Landroid/view/MotionEvent;", "")>]
[<System.Obsolete("deprecated")>]
static member Obtain : int64 * int64 * Android.Views.MotionEventActions * int * single * single * single * single * Android.Views.MetaKeyStates * single * single * int * Android.Views.Edge -> Android.Views.MotionEvent

Parameters

downTime
Int64

The time (in ms) when the user originally pressed down to start a stream of position events. This must be obtained from SystemClock#uptimeMillis().

eventTime
Int64

The time (in ms) when this specific event was generated. This must be obtained from SystemClock#uptimeMillis().

action
MotionEventActions

The kind of action being performed, such as #ACTION_DOWN.

pointerCount
Int32

The number of pointers that are active in this event.

x
Single

The X coordinate of this event.

y
Single

The Y coordinate of this event.

pressure
Single

The current pressure of this event. The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure), however values higher than 1 may be generated depending on the calibration of the input device.

size
Single

A scaled value of the approximate size of the area being pressed when touched with the finger. The actual value in pixels corresponding to the finger touch is normalized with a device specific range of values and scaled to a value between 0 and 1.

metaState
MetaKeyStates

The state of any meta / modifier keys that were in effect when the event was generated.

xPrecision
Single

The precision of the X coordinate being reported.

yPrecision
Single

The precision of the Y coordinate being reported.

deviceId
Int32

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; other numbers are arbitrary and you shouldn't depend on the values.

edgeFlags
Edge

A bitfield indicating which edges, if any, were touched by this MotionEvent.

Returns

Attributes

Remarks

Create a new MotionEvent, filling in all of the basic values that define the motion.

This member is deprecated. Use #obtain(long, long, int, float, float, float, float, int, float, float, int, int) instead.

Java documentation for android.view.MotionEvent.obtain(long, long, int, int, float, float, float, float, int, float, float, int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Obtain(Int64, Int64, MotionEventActions, Int32, Int32[], MotionEvent+PointerCoords[], MetaKeyStates, Single, Single, Int32, Edge, InputSourceType, MotionEventFlags)

Caution

deprecated

Create a new MotionEvent, filling in all of the basic values that define the motion.

[Android.Runtime.Register("obtain", "(JJII[I[Landroid/view/MotionEvent$PointerCoords;IFFIIII)Landroid/view/MotionEvent;", "")]
[System.Obsolete("deprecated")]
public static Android.Views.MotionEvent? Obtain (long downTime, long eventTime, Android.Views.MotionEventActions action, int pointerCount, int[]? pointerIds, Android.Views.MotionEvent.PointerCoords[]? pointerCoords, Android.Views.MetaKeyStates metaState, float xPrecision, float yPrecision, int deviceId, Android.Views.Edge edgeFlags, Android.Views.InputSourceType source, Android.Views.MotionEventFlags flags);
[<Android.Runtime.Register("obtain", "(JJII[I[Landroid/view/MotionEvent$PointerCoords;IFFIIII)Landroid/view/MotionEvent;", "")>]
[<System.Obsolete("deprecated")>]
static member Obtain : int64 * int64 * Android.Views.MotionEventActions * int * int[] * Android.Views.MotionEvent.PointerCoords[] * Android.Views.MetaKeyStates * single * single * int * Android.Views.Edge * Android.Views.InputSourceType * Android.Views.MotionEventFlags -> Android.Views.MotionEvent

Parameters

downTime
Int64

The time (in ms) when the user originally pressed down to start a stream of position events. This must be obtained from SystemClock#uptimeMillis().

eventTime
Int64

The the time (in ms) when this specific event was generated. This must be obtained from SystemClock#uptimeMillis().

action
MotionEventActions

The kind of action being performed, such as #ACTION_DOWN.

pointerCount
Int32

The number of pointers that will be in this event.

pointerIds
Int32[]

An array of pointerCount values providing an identifier for each pointer.

pointerCoords
MotionEvent.PointerCoords[]

An array of pointerCount values providing a MotionEvent PointerCoords coordinate object for each pointer.

metaState
MetaKeyStates

The state of any meta / modifier keys that were in effect when the event was generated.

xPrecision
Single

The precision of the X coordinate being reported.

yPrecision
Single

The precision of the Y coordinate being reported.

deviceId
Int32

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; other numbers are arbitrary and you shouldn't depend on the values.

edgeFlags
Edge

A bitfield indicating which edges, if any, were touched by this MotionEvent.

source
InputSourceType

The source of this event.

flags
MotionEventFlags

The motion event flags.

Returns

Attributes

Remarks

Java documentation for android.view.MotionEvent.obtain(long, long, int, float, float, float, float, int, float, float, int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Obtain(Int64, Int64, Int32, Single, Single, Single, Single, MetaKeyStates, Single, Single, Int32, Edge)

public static Android.Views.MotionEvent? Obtain (long downTime, long eventTime, int action, float x, float y, float pressure, float size, Android.Views.MetaKeyStates metaState, float xPrecision, float yPrecision, int deviceId, Android.Views.Edge edgeFlags);
static member Obtain : int64 * int64 * int * single * single * single * single * Android.Views.MetaKeyStates * single * single * int * Android.Views.Edge -> Android.Views.MotionEvent

Parameters

downTime
Int64
eventTime
Int64
action
Int32
x
Single
y
Single
pressure
Single
size
Single
metaState
MetaKeyStates
xPrecision
Single
yPrecision
Single
deviceId
Int32
edgeFlags
Edge

Returns

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Obtain(Int64, Int64, MotionEventActions, Single, Single, Single, Single, MetaKeyStates, Single, Single, Int32, Edge)

Create a new MotionEvent, filling in all of the basic values that define the motion.

[Android.Runtime.Register("obtain", "(JJIFFFFIFFII)Landroid/view/MotionEvent;", "")]
public static Android.Views.MotionEvent? Obtain (long downTime, long eventTime, Android.Views.MotionEventActions action, float x, float y, float pressure, float size, Android.Views.MetaKeyStates metaState, float xPrecision, float yPrecision, int deviceId, Android.Views.Edge edgeFlags);
[<Android.Runtime.Register("obtain", "(JJIFFFFIFFII)Landroid/view/MotionEvent;", "")>]
static member Obtain : int64 * int64 * Android.Views.MotionEventActions * single * single * single * single * Android.Views.MetaKeyStates * single * single * int * Android.Views.Edge -> Android.Views.MotionEvent

Parameters

downTime
Int64

The time (in ms) when the user originally pressed down to start a stream of position events. This must be obtained from SystemClock#uptimeMillis().

eventTime
Int64

The time (in ms) when this specific event was generated. This must be obtained from SystemClock#uptimeMillis().

action
MotionEventActions

The kind of action being performed, such as #ACTION_DOWN.

x
Single

The X coordinate of this event.

y
Single

The Y coordinate of this event.

pressure
Single

The current pressure of this event. The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure), however values higher than 1 may be generated depending on the calibration of the input device.

size
Single

A scaled value of the approximate size of the area being pressed when touched with the finger. The actual value in pixels corresponding to the finger touch is normalized with a device specific range of values and scaled to a value between 0 and 1.

metaState
MetaKeyStates

The state of any meta / modifier keys that were in effect when the event was generated.

xPrecision
Single

The precision of the X coordinate being reported.

yPrecision
Single

The precision of the Y coordinate being reported.

deviceId
Int32

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; other numbers are arbitrary and you shouldn't depend on the values.

edgeFlags
Edge

A bitfield indicating which edges, if any, were touched by this MotionEvent.

Returns

Attributes

Remarks

Create a new MotionEvent, filling in all of the basic values that define the motion.

Java documentation for android.view.MotionEvent.obtain(long, long, int, float, float, float, float, int, float, float, int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Obtain(Int64, Int64, Int32, Single, Single, MetaKeyStates)

public static Android.Views.MotionEvent? Obtain (long downTime, long eventTime, int action, float x, float y, Android.Views.MetaKeyStates metaState);
static member Obtain : int64 * int64 * int * single * single * Android.Views.MetaKeyStates -> Android.Views.MotionEvent

Parameters

downTime
Int64
eventTime
Int64
action
Int32
x
Single
y
Single
metaState
MetaKeyStates

Returns

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Obtain(Int64, Int64, MotionEventActions, Single, Single, MetaKeyStates)

Create a new MotionEvent, filling in a subset of the basic motion values.

[Android.Runtime.Register("obtain", "(JJIFFI)Landroid/view/MotionEvent;", "")]
public static Android.Views.MotionEvent? Obtain (long downTime, long eventTime, Android.Views.MotionEventActions action, float x, float y, Android.Views.MetaKeyStates metaState);
[<Android.Runtime.Register("obtain", "(JJIFFI)Landroid/view/MotionEvent;", "")>]
static member Obtain : int64 * int64 * Android.Views.MotionEventActions * single * single * Android.Views.MetaKeyStates -> Android.Views.MotionEvent

Parameters

downTime
Int64

The time (in ms) when the user originally pressed down to start a stream of position events. This must be obtained from SystemClock#uptimeMillis().

eventTime
Int64

The time (in ms) when this specific event was generated. This must be obtained from SystemClock#uptimeMillis().

action
MotionEventActions

The kind of action being performed, such as #ACTION_DOWN.

x
Single

The X coordinate of this event.

y
Single

The Y coordinate of this event.

metaState
MetaKeyStates

The state of any meta / modifier keys that were in effect when the event was generated.

Returns

Attributes

Remarks

Create a new MotionEvent, filling in a subset of the basic motion values. Those not specified here are: device id (always 0), pressure and size (always 1), x and y precision (always 1), and edgeFlags (always 0).

Java documentation for android.view.MotionEvent.obtain(long, long, int, float, float, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Obtain(MotionEvent)

Create a new MotionEvent, copying from an existing one.

[Android.Runtime.Register("obtain", "(Landroid/view/MotionEvent;)Landroid/view/MotionEvent;", "")]
public static Android.Views.MotionEvent? Obtain (Android.Views.MotionEvent? other);
[<Android.Runtime.Register("obtain", "(Landroid/view/MotionEvent;)Landroid/view/MotionEvent;", "")>]
static member Obtain : Android.Views.MotionEvent -> Android.Views.MotionEvent

Parameters

other
MotionEvent

Returns

Attributes

Remarks

Create a new MotionEvent, copying from an existing one.

Java documentation for android.view.MotionEvent.obtain(android.view.MotionEvent).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to