Code example for Instrumentation

Methods: sendPointerSync

1
        int realY = getRealCoord(y);
        long downTime = SystemClock.uptimeMillis();
        // event time MUST be retrieved only by this way! 
        long eventTime = SystemClock.uptimeMillis();
        MotionEvent event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_DOWN, realX, realY, 0);
        inst.sendPointerSync(event);
        fingerDown = true;
    } 
     
    //Move from the touch start 
    public void touchMove(int x, int y)
    { 
        if(!fingerDown)
            touchStart(x,y);
        else 
        { 
            int realX = getRealCoord(x);
            int realY = getRealCoord(y);
            long downTime = SystemClock.uptimeMillis();
            // event time MUST be retrieved only by this way! 
            long eventTime = SystemClock.uptimeMillis();