IT. Expert System.

Android Reference

VelocityTracker


android.view

Class VelocityTracker

    • Method Detail

      • obtain

        public static VelocityTracker obtain()
        Retrieve a new VelocityTracker object to watch the velocity of a motion. Be sure to call recycle() when done. You should generally only maintain an active object while tracking a movement, so that the VelocityTracker can be re-used elsewhere.
        Returns:
        Returns a new VelocityTracker.
      • obtain

        public static VelocityTracker obtain(String strategy)
        Obtains a velocity tracker with the specified strategy. For testing and comparison purposes only.
        Parameters:
        strategy - The strategy, or null to use the default.
        Returns:
        The velocity tracker.
      • recycle

        public void recycle()
        Return a VelocityTracker object back to be re-used by others. You must not touch the object after calling this function.
      • finalize

        protected void finalize()
                         throws Throwable
        Description copied from class: Object
        Invoked when the garbage collector has detected that this instance is no longer reachable. The default implementation does nothing, but this method can be overridden to free resources.

        Note that objects that override finalize are significantly more expensive than objects that don't. Finalizers may be run a long time after the object is no longer reachable, depending on memory pressure, so it's a bad idea to rely on them for cleanup. Note also that finalizers are run on a single VM-wide finalizer thread, so doing blocking work in a finalizer is a bad idea. A finalizer is usually only necessary for a class that has a native peer and needs to call a native method to destroy that peer. Even then, it's better to provide an explicit close method (and implement Closeable), and insist that callers manually dispose of instances. This works well for something like files, but less well for something like a BigInteger where typical calling code would have to deal with lots of temporaries. Unfortunately, code that creates lots of temporaries is the worst kind of code from the point of view of the single finalizer thread.

        If you must use finalizers, consider at least providing your own ReferenceQueue and having your own thread process that queue.

        Unlike constructors, finalizers are not automatically chained. You are responsible for calling super.finalize() yourself.

        Uncaught exceptions thrown by finalizers are ignored and do not terminate the finalizer thread. See Effective Java Item 7, "Avoid finalizers" for more.

        Overrides:
        finalize in class Object
        Throws:
        Throwable
      • clear

        public void clear()
        Reset the velocity tracker back to its initial state.
      • addMovement

        public void addMovement(MotionEvent event)
        Add a user's movement to the tracker. You should call this for the initial MotionEvent.ACTION_DOWN, the following MotionEvent.ACTION_MOVE events that you receive, and the final MotionEvent.ACTION_UP. You can, however, call this for whichever events you desire.
        Parameters:
        event - The MotionEvent you received and would like to track.
      • computeCurrentVelocity

        public void computeCurrentVelocity(int units,
                                  float maxVelocity)
        Compute the current velocity based on the points that have been collected. Only call this when you actually want to retrieve velocity information, as it is relatively expensive. You can then retrieve the velocity with getXVelocity() and getYVelocity().
        Parameters:
        units - The units you would like the velocity in. A value of 1 provides pixels per millisecond, 1000 provides pixels per second, etc.
        maxVelocity - The maximum velocity that can be computed by this method. This value must be declared in the same unit as the units parameter. This value must be positive.
      • getXVelocity

        public float getXVelocity()
        Retrieve the last computed X velocity. You must first call computeCurrentVelocity(int) before calling this function.
        Returns:
        The previously computed X velocity.
      • getYVelocity

        public float getYVelocity()
        Retrieve the last computed Y velocity. You must first call computeCurrentVelocity(int) before calling this function.
        Returns:
        The previously computed Y velocity.
      • getXVelocity

        public float getXVelocity(int id)
        Retrieve the last computed X velocity. You must first call computeCurrentVelocity(int) before calling this function.
        Parameters:
        id - Which pointer's velocity to return.
        Returns:
        The previously computed X velocity.
      • getYVelocity

        public float getYVelocity(int id)
        Retrieve the last computed Y velocity. You must first call computeCurrentVelocity(int) before calling this function.
        Parameters:
        id - Which pointer's velocity to return.
        Returns:
        The previously computed Y velocity.
      • getEstimator

        public boolean getEstimator(int id,
                           VelocityTracker.Estimator outEstimator)
        Get an estimator for the movements of a pointer using past movements of the pointer to predict future movements. It is not necessary to call computeCurrentVelocity(int) before calling this method.
        Parameters:
        id - Which pointer's velocity to return.
        outEstimator - The estimator to populate.
        Returns:
        True if an estimator was obtained, false if there is no information available about the pointer.


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 11001 / . Delta: 0.03144 с