diff --git a/app/src/main/java/com/refugeye/DrawingView.java b/app/src/main/java/com/refugeye/DrawingView.java index 6da9633..5e3397f 100644 --- a/app/src/main/java/com/refugeye/DrawingView.java +++ b/app/src/main/java/com/refugeye/DrawingView.java @@ -23,7 +23,7 @@ public class DrawingView extends View { public Path drawPath; private Paint canvasPaint; - private Bitmap canvasBitmap; + private Bitmap canvasBitmap = null; public Paint drawPaint; public Canvas drawCanvas; @@ -58,10 +58,12 @@ public void setupDrawing() { @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); - canvasBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); - drawCanvas = new Canvas(canvasBitmap); - drawCanvas.drawColor(Color.WHITE); - invalidate(); + if (canvasBitmap == null) { + canvasBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); + drawCanvas = new Canvas(canvasBitmap); + drawCanvas.drawColor(Color.WHITE); + invalidate(); + } } @Override