Handle Basic Touch Events in Android

by Sasikumar 2014-03-24 16:28:41

To handle basic touch events in android use the following function
public boolean onTouchEvent(MotionEvent event) {
int eventaction = event.getAction();
switch (eventaction) {
case MotionEvent.ACTION_DOWN:
// finger touches the screen
break;
case MotionEvent.ACTION_MOVE:
// finger moves on the screen
break;
case MotionEvent.ACTION_UP:
// finger leaves the screen
break;
}
return true; // tell the system that we handled the event and no further processing is required
}
766
like
0
dislike
0
mail
flag

You must LOGIN to add comments