Android Guides | Samples

Android.Views.VelocityTracker Class

Helper for tracking the velocity of touch events, for implementing flinging and other such gestures.

See Also: VelocityTracker

Syntax

[Android.Runtime.Register("android/view/VelocityTracker", DoNotGenerateAcw=true)]
public sealed class VelocityTracker : Object

Remarks

Helper for tracking the velocity of touch events, for implementing flinging and other such gestures. Use VelocityTracker.Obtain to retrieve a new instance of the class when you are going to begin tracking. Put the motion events you receive into it with VelocityTracker.AddMovement(MotionEvent). When you want to determine the velocity call VelocityTracker.ComputeCurrentVelocity(Int32) and then call VelocityTracker.GetXVelocity(Int32) and VelocityTracker.GetYVelocity(Int32) to retrieve the velocity for each pointer id.

[Android Documentation]

Requirements

Namespace: Android.Views
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1

The members of Android.Views.VelocityTracker are listed below.

See Also: Object

Public Properties

[read-only]
XVelocitySingle. Retrieve the last computed X velocity.
[read-only]
YVelocitySingle. Retrieve the last computed Y velocity.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

AddMovement(MotionEvent)
Add a user's movement to the tracker.
Clear()
Reset the velocity tracker back to its initial state.
ComputeCurrentVelocity(Int32)
Equivalent to invoking VelocityTracker.ComputeCurrentVelocity(Int32,Single) with a maximum velocity of Float.
ComputeCurrentVelocity(Int32, Single)
Compute the current velocity based on the points that have been collected.
GetXVelocity(Int32) : Single
Retrieve the last computed X velocity.
GetYVelocity(Int32) : Single
Retrieve the last computed Y velocity.
static
Obtain() : VelocityTracker
Retrieve a new VelocityTracker object to watch the velocity of a motion.
Recycle()
Return a VelocityTracker object back to be re-used by others.