title: Error: width and height must be > 0 android when changing contrast
body: <p>I got problem with my simple image editor. After contrast change I am trying to set new, edited image, but exception appears.</p>
  
  <pre><code>public ContrastBrightnessDialog(Context context, String title, final DrawingView drawView) {
      super(context);
      this.setContentView(R.layout.contrastbrightness_dialog);
      this.setTitle(title);
  
      txtView = (TextView) findViewById(R.id.textView1);
      contrastValue = (TextView) findViewById(R.id.contrast_value);
      brightnessValue = (TextView) findViewById(R.id.textView1);
      contrastSB = (SeekBar) findViewById(R.id.contrast_seekbar);
      contrastSB.setProgress(0);
  
      contrastSB.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
                  @Override
                  public void onProgressChanged(SeekBar seekBar,
                          int progress, boolean fromUser) {
                      // TODO Auto-generated method stub
                      contrastValue.setText(String.valueOf(progress - 100));
                      contrastInt = Integer.parseInt(String
                              .valueOf(progress - 100));
                  }
  
                  @Override
                  public void onStartTrackingTouch(SeekBar seekBar) {
                      // TODO Auto-generated method stub
                  }
  
                  @Override
                  public void onStopTrackingTouch(SeekBar seekBar) {
                      // TODO Auto-generated method stub
                  }
              });
  
      confirmBtn = (Button) findViewById(R.id.confirm_btn);
      confirmBtn.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
                      drawView.setDrawingCacheEnabled(true);
                      drawView.measure(
                              MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),
                              MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
                      drawView.layout(0, 0, drawView.getMeasuredWidth(),
                              drawView.getMeasuredHeight());
  
                      drawView.buildDrawingCache(true);
  
                      Bitmap bmin = Bitmap.createBitmap(drawView.getDrawingCache());
  
                      BitmapFactory.Options options = new BitmapFactory.Options();
  
                      options.inPreferredConfig = Bitmap.Config.ARGB_8888;
                      Bitmap workingBitmap = Bitmap.createBitmap(doContrast(bmin,
                              contrastInt));
  
                      Bitmap mutableBitmap = workingBitmap.copy(
                              Bitmap.Config.ARGB_8888, true);
                      options = new BitmapFactory.Options();
                      Drawable d = new BitmapDrawable(drawView.getResources(),
                              mutableBitmap);
                      drawView.setBackground(d);
                      drawView.setDrawingCacheEnabled(false);
              close();
          }
      });
  }
  
  public Bitmap doContrast(Bitmap src, int value) {
   //contrast algorithm from https://xjaphx.wordpress.com/2011/06/21/image-processing-contrast-image-on-the-fly/
  return someBitmap;}
  </code></pre>
  
  <p>And here is a method from my DrawingView class (extends ImageView), which gets and line with error. Debuger shows w and h are equal 0.</p>
  
  <pre><code>@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);//here is an error
      drawCanvas = new Canvas(canvasBitmap);
  }
  </code></pre>