Code example for Camera

Methods: getParametersreleasesetDisplayOrientationsetParameterssetPreviewDisplay

0
			if(mHolder == null)
			{ 
				return; 
			} 
 
			mCamera.setPreviewDisplay(mHolder);
 
			// If we use the default preview size things seams to be more stable 
			Camera.Parameters param = mCamera.getParameters();
			mPreviewSize = param.getPreviewSize();
 
			mCamera.setParameters(param);
		} 
		catch (Exception e)
		{ 
			mCamera.release();
			mCamera = null;
		} 
	} 
 
	 /** 
	  * sets the Orientation of the camera Preview o be the same as MoSyncApp 
	  */ 
	private void setCameraDisplayOrientation() { 
		// Set the orientation of the picture on old Android phones 
		Camera.Parameters parameters = mCamera.getParameters();
 
		if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
			parameters.set("orientation", "portrait");
			// default camera orientation on android is landscape 
			// So we need to rotate the preview 
			parameters.setRotation(90);
			mCamera.setDisplayOrientation(90);
		} else if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
			parameters.set("orientation", "landscape");
			parameters.setRotation(0);
			mCamera.setDisplayOrientation(0);
		} 
		mCamera.setParameters(parameters);
	} 
 
	 /** 
	  * the function that is called by the system when the preview is destroyed 
	  */