public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) { // If your preview can change or rotate, take care of those events here. // Make sure to stop the preview before resizing or reformatting it. if (mHolder.getSurface() == null) { // preview surface does not exist return; } // stop preview before making changes try { mCamera.stopPreview(); Log.v(TAG, "stopPreview"); googleGlassXE10WorkAround(mCamera); } catch (Exception e) { // ignore: tried to stop a non-existent preview Log.d(TAG, "Tried to stop a non-existent preview: " + e.getMessage()); } // start preview with new settings try { mCamera.setPreviewDisplay(mHolder); mCamera.startPreview(); Log.v(TAG, "startPreview"); } catch (Exception e) { Log.d(TAG, "Error starting camera preview: " + e.getMessage()); } }