[Android] – Handle Touch Events (onTouchEvent)


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;
}

// tell the system that we handled the event and no further processing is required
return true;
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s