Code example for Instrumentation

Methods: sendPointerSyncwaitForIdleSync

0
     */ 
    public static void dragStart(Instrumentation instrumentation, float x, float y,
            long downTime) {
        MotionEvent event = MotionEvent.obtain(downTime, downTime,
                MotionEvent.ACTION_DOWN, x, y, 0);
        instrumentation.sendPointerSync(event);
        instrumentation.waitForIdleSync();
    } 
 
    /** 
     * Drags / moves (synchronously) to the specified coordinates. Normally preceeded by 
     * dragStart() and followed by dragEnd() 
     * 
     * @param instrumentation Instrumentation object used by the test. 
     * @param fromX The relative x-coordinate of the start point of the drag. 
     * @param toX The relative x-coordinate of the end point of the drag. 
     * @param fromY The relative y-coordinate of the start point of the drag. 
     * @param toY The relative y-coordinate of the end point of the drag. 
     * @param stepCount The total number of motion events that should be generated during the drag. 
     * @param downTime The initial time of the drag, in ms. 
     */