I would like to record the user's input in my drawing application. It can draw whatever he wants, not only shape with straight line. How can I record, in a single path, all the moves that the user does when he draws, for example, a particular circle? This is my method, where there is the System.out.println() is where I would push the method to save the Path.
public boolean onTouchEvent(MotionEvent event) {
float touchX = event.getX();
float touchY = event.getY();
//respond to down, move and up events
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
drawPath.moveTo(touchX, touchY);
break;
case MotionEvent.ACTION_MOVE:
drawPath.lineTo(touchX, touchY);
break;
case MotionEvent.ACTION_UP:
drawPath.lineTo(touchX, touchY);
System.out.println(touchX +", " +touchY);
drawCanvas.drawPath(drawPath, drawPaint);
drawPath.reset();
break;
default:
return false;
}
//redraw
invalidate();
return true;
}```