Code example for VelocityTracker

Methods: addMovement

        addMotionEvent(vt, endX, endY, startime + duration, MotionEvent.ACTION_UP);
    private void addMotionEvent(VelocityTracker vt, int x, int y, long time, int action) {
        MotionEvent me = MotionEvent.obtain(time, time, action, x, y, 0);
     * Float imprecision of the average computations and filtering 
     * (removing last MotionEvent for N > 3) implies that tests 
     *  accepts some approximated values. 
    private void assertEqualFuzzy(float expected, float actual, float threshold) {
        boolean fuzzyEqual = actual >= expected - threshold && actual <= expected + threshold;
        Assert.assertTrue("Expected: <"+expected+"> but was: <"+actual+
                "> while accepting a variation of: <"+threshold+">", fuzzyEqual);
Connect your IDE to all the code out there  Get Codota for Java