Code example for Camera.Parameters

Methods: getPreviewFormat, getPreviewSize

0
		try { 
			mCamera.setPreviewCallback(pc);
			mCamera.setPreviewDisplay(holder);
			mCamera.startPreview();
			parameters = mCamera.getParameters();
			previewSize = parameters.getPreviewSize();
			pixels = new int[previewSize.width
					* previewSize.height
					* (ImageFormat.getBitsPerPixel(parameters
							.getPreviewFormat())) / 8];
 
		} catch (IOException e) {
			Log.d(TAG, "Error setting camera preview: " + e.getMessage());
		} 
	} 
 
	public void surfaceDestroyed(SurfaceHolder holder) {
		// empty. Take care of releasing the Camera preview in your activity. 
		if (mCamera != null) {
			mCamera.stopPreview();
Experience pair programming with AI  Get Codota for Java