I am trying to catch double-tap events using OnTouchListener. I figure I would set a long for motionEvent.ACTION_DOWN, and a different long for a second motionEvent.ACTION_DOWN and measure the time between the two of them and then do something with it. However, I am having a hard time figuring out exactly how to approach this. I am using switch cases to pick up multitouch events, so I'd rather not try and retool this all to implement GestureDetector (and unfortunately it is impossible to implement both ontouchlistener and Gesturedetector simultaneously). Any ideas would help greatly:
i.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
ImageView i = (ImageView) v;
switch (event.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN:
long firstTouch = System.currentTimeMillis();
///how to grab the second action_down????
break;
I addressed this problem earlier. It involves using a Handler to wait a certain amount of time to wait for the second click: How can I create a Single Click Event and Double Click Event when the Menu Button is pressed?