0

I wonder if it's possible to do more than one touch with one touch. Like multi click with mouse with one button.

Thanks in advance

dpapatsarouchas
  • 151
  • 1
  • 2
  • 15
  • are you referring to double-click or double-tap? – Kasra Feb 09 '15 at 00:36
  • Double tap. I searched around Google play if was there any app but nothing. I want to tap the screen one time and "send" more – dpapatsarouchas Feb 09 '15 at 00:39
  • possible duplicate of [How to simulate a touch event in Android?](http://stackoverflow.com/questions/4396059/how-to-simulate-a-touch-event-in-android) – alanv Feb 09 '15 at 07:06

1 Answers1

0

You need GestureDetector for the purpose of detecting double taps. See this example:

 public class MyView extends View {
GestureDetector gestureDetector;

public MyView(Context context, AttributeSet attrs) {
    super(context, attrs);
            // creating new gesture detector
    gestureDetector = new GestureDetector(context, new GestureListener());
}

// skipping measure calculation and drawing

    // delegate the event to the gesture detector
@Override
public boolean onTouchEvent(MotionEvent e) {
    return gestureDetector.onTouchEvent(e);
}


private class GestureListener extends GestureDetector.SimpleOnGestureListener {

    @Override
    public boolean onDown(MotionEvent e) {
        return true;
    }
    // event when double tap occurs
    @Override
    public boolean onDoubleTap(MotionEvent e) {
        float x = e.getX();
        float y = e.getY();

        Log.d("Double Tap", "Tapped at: (" + x + "," + y + ")");

        return true;
    }
}
}
Kasra
  • 3,045
  • 3
  • 17
  • 34
  • I wasn't clear I don't want to detect double tap I want to do double triple etc. .. tap with one tap. So when I touch the screen one time "system" get 2 or more touch commands – dpapatsarouchas Feb 09 '15 at 00:53
  • Oops... I see... You want to FORCE a fake double tap into the system pipeline.... Unfortunately I don't know any solution for that! Sorry... – Kasra Feb 09 '15 at 01:19
  • Although this might help: http://stackoverflow.com/questions/4396059/how-to-simulate-a-touch-event-in-android – Kasra Feb 09 '15 at 01:20