I need to get the touch begin position (X, Y) , touch move position and touch end position of the screen in android.
A:
@Override
public boolean onTouch(View v, MotionEvent event) {
int x = event.getX();
int y = event.getY();
return true;
}
Sephy
2010-08-13 12:34:31
Thank You Sephy
Alex
2010-08-13 12:59:46
A:
You can implement a Gesture deductor and on its onfling event you get two parameters from MotionEvent class. You can get your x and y coordinates from them. Look out for this post for more details
http://stackoverflow.com/questions/937313/android-basic-gesture-detection
Rahul
2010-08-13 12:34:39
+2
A:
@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:
}
}
yaourt
2010-08-13 12:37:30