title: Canvas draw black screen before touch
body: <p>I want to draw black dots when I touch the screen and its work, but when I start the activity for the first time the screen is black and after the touch is going white.I want to be white from the beggining. How can I fix it? Here is my code:</p>
  
  <pre><code>package com.inveitix.android.clue.ui.views;
  
  import android.content.Context;
  import android.graphics.Canvas;
  import android.graphics.Color;
  import android.graphics.Paint;
  import android.graphics.Point;
  import android.util.AttributeSet;
  import android.view.Display;
  import android.view.MotionEvent;
  import android.view.SurfaceHolder;
  import android.view.SurfaceView;
  import android.view.WindowManager;
  
  /**
   * Created by Tito on 3.2.2016 г..
   */
  public class DrawingView extends SurfaceView {
  
      private final Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
      Canvas canvas;
      int width;
      int height;
      private SurfaceHolder surfaceHolder;
      private WindowManager wm;
  
  
      public DrawingView(Context context) {
          super(context);
          init();
      }
  
      public DrawingView(Context context, AttributeSet attrs) {
          super(context, attrs);
          init();
      }
  
      public DrawingView(Context context, AttributeSet attrs, int defStyleAttr) {
          super(context, attrs, defStyleAttr);
          init();
      }
  
      private void init() {
          surfaceHolder = getHolder();
          wm = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);
          paint.setColor(Color.BLACK);
          paint.setStyle(Paint.Style.FILL);
          getScreenSize();
      }
  
  
      private void getScreenSize() {
          Display display = wm.getDefaultDisplay();
          Point size = new Point();
          display.getSize(size);
          width = size.x;
          height = size.y;
      }
  
      @Override
      public boolean onTouchEvent(MotionEvent event) {
          if (event.getAction() == MotionEvent.ACTION_DOWN) {
              if (surfaceHolder.getSurface().isValid()) {
                  canvas = surfaceHolder.lockCanvas();
                  canvas.drawColor(Color.WHITE);
                  canvas.drawCircle(event.getX(), event.getY(), 10, paint);
                  surfaceHolder.unlockCanvasAndPost(canvas);
              }
          }
          return false;
      }
  }
  </code></pre>