0

I used this code to clear the paint:

paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));

paint.setColor(Color.GREEN);
Kara
  • 6,115
  • 16
  • 50
  • 57
  • Explain, and put some part of code where you want to change – Engr Waseem Arain Dec 03 '13 at 05:41
  • i'm using to clear the canvas "paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));" dis stmt. but it shows default colour black when clear the paint. – user2783757 Dec 03 '13 at 05:45
  • http://stackoverflow.com/questions/5729377/android-canvas-how-do-i-clear-delete-contents-of-a-canvas-bitmaps-livin – Linga Dec 03 '13 at 05:49

2 Answers2

2

Try that, drawView is the canvas name

drawView.clearPoints();

Add method;

public void clearPoints() {
    points.clear();
    invalidate();
}
Engr Waseem Arain
  • 1,163
  • 1
  • 17
  • 36
1

Try to set your own color on canvas like this :

Canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
Harshit Rathi
  • 1,862
  • 2
  • 18
  • 25