I'm looking to get some code to work where on double tap the canvas gets restored.
At the moment, I have:
@Override
public void onTouchEvent(MotionEvent event) {
float x = event.getX();
float y = event.getY();
SurfaceHolder holder = getSurfaceHolder();
Canvas canvas = null;
try {
canvas = holder.lockCanvas();
if (canvas != null) {
// Enter it all here
canvas.restore();
}
} finally {
if (canvas != null)
holder.unlockCanvasAndPost(canvas);
}
super.onTouchEvent(event);
}
However, at the moment it reads any gesture and it restores the screen. I only want it to restore on a double tap gesture.
I have tried to get this to work: Android: How to detect double-tap? but so far I've failed.
Thanks for any help :)