1

In the following function:

protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    canvas.drawBitmap( bmp ,0,0,null);
    ViewCompat.postOnAnimationDelayed( this, new Runnable() {
        @Override
        public void run() {
            Canvas c = new Canvas(bmp);
            c.drawColor(Color.BLUE);
        }
    },1000);
}

bmp is a regular image.

  • I am drawing the bitmap on the canvas.
  • On the next animation frame + 1 sec, I'm changing the content of the bitmap to blue.
  • I'm NOT drawing the bitmap again.

The result is a blue screen.

Does this mean that the canvas is storing a reference to the bitmap?

0 Answers0