0

I have an ImageView loaded with bitmap. When user touches on the bitmap, I draw a circle using canvas at the touched position on the bitmap. Now, I need to undo the drawn circle. Everywhere, I find snippets to undo paths drawn and not a circle directly. Does anyone have a solution to undo the previously drawn circle ?

Riny
  • 159
  • 1
  • 6
  • 17
  • First of all, the code of onDraw() might be usefull. Why not just call invalidate() and avoid circle drawing? – sandrstar Oct 26 '13 at 07:42

1 Answers1

0

There are two ways to erase the previous drawings

If you want to continue with the bitmap just assign null to the bitmap object when you want to remove the drawings in the bitmap. When you assign null the entire bitmap will cleared.

bitmapobj = null;

Another method is using the canvas for drawing, then each time you call the invalidate() the entire canvas will redraw and erase the previous drawing. (Invalidate() is the default method that call the onDraw() which draws the shapes).

Ciril
  • 420
  • 3
  • 9