Search code examples
androidtouchontouchlistener

OnTouchListener handles only ACTION_DOWN


It handles only ACTION_DOWN (in new project also). No event ACTION_UP, ACTION_MOVE:

public boolean onTouch(View v, MotionEvent event) {
        switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
                Log.d("DOWN", "S");
                break;
            case MotionEvent.ACTION_MOVE:
                Log.d("MOVE", "S");
                break;
            case MotionEvent.ACTION_UP:
            case MotionEvent.ACTION_CANCEL:
                Log.d("UP", "S");
                break;
        }
        return false;
}

Solution

  • That because:

    return false;
    

    It mean you don't receive any events after ACTION_DOWN.

    Change to:

    return true;