Code example for Camera.Parameters

Methods: setPreviewSize, setRotation

0
	       
	      	Display display = window_manager.getDefaultDisplay(); 
 
	        if(display.getRotation() == Surface.ROTATION_0) 
	        { 
	            parameters.setPreviewSize(height, width);    
	            parameters.setRotation(90); 
	            camera.setDisplayOrientation(90); 
//	            Log.d("orientation","rotation 0 -> orientation 90"); 
	             
	             
	        } 
 
	        if(display.getRotation() == Surface.ROTATION_90) 
	        { 
	            parameters.setPreviewSize(width, height); 
	            parameters.setRotation(0); 
	            camera.setDisplayOrientation(0); 
//	            Log.d("orientation","rotation 90 -> no orientation "); 
	        } 
 
	        if(display.getRotation() == Surface.ROTATION_180) 
	        { 
	            parameters.setPreviewSize(height, width); 
	            parameters.setRotation(0); 
//	            Log.d("orientation","rotation 180 -> no orientation"); 
	        } 
 
	        if(display.getRotation() == Surface.ROTATION_270) 
	        { 
	            parameters.setPreviewSize(width, height); 
	            parameters.setRotation(180); 
	            camera.setDisplayOrientation(180); 
//	            Log.d("orientation","rotation 270 -> orientation 180"); 
	        }