I went through FingerPaint.java
from APIDemos ie android-sdk\samples\android-17\ApiDemos
and modified
@Override protected void onDraw(Canvas canvas) { canvas.drawColor(0xFFAAAAAA); canvas.drawBitmap(mBitmap, 0, 0, mBitmapPaint); canvas.drawPath(mPath, mPaint); }
to
@Override protected void onDraw(Canvas canvas) { canvas.drawColor(0xFFAAAAAA); canvas.drawBitmap(mBitmap, 0, 0, mBitmapPaint); mCanvas.drawPath(mPath, mPaint); // this line changed // mCanvas is Canvas variable which is // initialized in onSizeChanged() }
Now he does not paint black when erased, everything works fine. Not sure if this is a 100% correct answer, but it works for me.
source share