@Override
 public void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i2, int i3) {
   if (surfaceHolder.getSurface() == null) {
     return;
   }
   stopCameraPreview();
   showCameraPreview();
 }
 public void initCameraPreview() {
   if (mCamera != null) {
     getHolder().addCallback(this);
     getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
     getHolder().setFormat(PixelFormat.TRANSLUCENT);
     if (mPreviewing) {
       requestLayout();
     } else {
       showCameraPreview();
     }
   }
 }