Alex Alex - 4 months ago 8
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.

Answer
@Override
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;
}