Code example for Camera

Methods: setErrorCallbackstartPreview

0
			if(this.mActivity.isFinishing()) return;
			this.ensureCameraDevice();
			if(this.mPreviewing) this.stopPreview();
			this.setPreviewDisplay(this.mSurfaceHolder);
			this.setCameraParameters();
			this.mCameraDevice.setErrorCallback(mErrorCallback);
			try { 
	            Log.v(TAG, "startPreview");
	            this.mCameraDevice.startPreview();
	            /************************************************ 
		         * Hack for when preview was technically started (but 
		         * probably not all the way started) and autofocus was  
		         * crashing the camera hardware.That or I wrote crappy 
		         * code somewhere.  Super rare crash but the worst kind. 
		         *************************************************/ 
		        Thread.sleep(100);
	        } catch (Throwable ex) {
	            this.closeCamera();
	            throw new RuntimeException("startPreview failed", ex);
	        } 
Experience pair programming with AI  Get Codota for Java