dinesh707 dinesh707 - 1 year ago 67
Android Question

Touch Release method in Android

I'm trying to capture the

event in Android. I have seen that
returns the action type. But inside
it always gives the action

Do you know how to capture the touch release event.

public boolean onTouchEvent(MotionEvent event) {
return super.onTouchEvent(event);

Answer Source

You have ACTION_UP: http://developer.android.com/reference/android/view/MotionEvent.html#ACTION_UP

View view = new View();

view.setOnTouchListener(new OnTouchListener () {
  public boolean onTouch(View view, MotionEvent event) {
    if (event.getAction() == android.view.MotionEvent.ACTION_DOWN) {
      Log.d("TouchTest", "Touch down");
    } else if (event.getAction() == android.view.MotionEvent.ACTION_UP) {
      Log.d("TouchTest", "Touch up");
    return true;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download