Alex Alex - 5 months ago 10
Android Question

How to get the Touch position in android?

I need to get the touch begin position (X, Y) , touch move position and touch end position of the screen in android.

public boolean onTouchEvent(MotionEvent event) {
    int x = (int)event.getX();
    int y = (int)event.getY();
    switch (event.getAction()) {
        case MotionEvent.ACTION_DOWN:
        case MotionEvent.ACTION_MOVE:
        case MotionEvent.ACTION_UP:
return false;