How to rewrite a Canvas (reuse it)
i've got a method which draws an auto-generated set of lines onto a Canvas. This works without problems. Now the question is, how to add e.g. lines on this Canvas with the onTouch event. I try to solve this with a Thread and a SurfaceView, but then the Thread draws the auto-generated set infinitely. (The lines i want to add have to be deletable).
Any suggestions would be appreciated, thanks.
Put your lines coordinates in arraylist of line objects and use loop in your onDraw method iterate every line to draw it on canvas. Add lines in arraylist onTouch. After adding line onTouch call invalidate() to update canvas.
this will call