Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
// Use of this source code is governed by a BSD-style license that can be

import android.os.SystemClock;
import android.view.MotionEvent;
import android.view.View;

public class Main {
    private static long dragStart(View view, float x, float y) {
        long downTime = SystemClock.uptimeMillis();
        sendAction(view, MotionEvent.ACTION_DOWN, downTime, x, y);
        return downTime;
    }

    private static void sendAction(View view, int action, long downTime, float x, float y) {
        long eventTime = SystemClock.uptimeMillis();
        MotionEvent event = MotionEvent.obtain(downTime, eventTime, action, x, y, 0);
        view.onTouchEvent(event);
    }
}