Code example for Camera.Parameters

Methods: getPreviewSize, setPreviewSize

0
						params, (Object[]) null);
				if (supportedFormats instanceof List<?>) {
					sizes = (List<Camera.Size>) supportedFormats;// params.getSupportedPreviewSizes();
					Size optimalSize = GraphicsUtil.getOptimalPreviewSize(
							sizes, width, height);
					Size currentSize = params.getPreviewSize();
					if (!(optimalSize.height == currentSize.height && optimalSize.width == currentSize.width)) {
						// the optimal size was not set, yet. so let's do so now 
						Log.d("AndAR", "'query preview sizes' available, setting size to: "+width+" x "+height);
						params.setPreviewSize(optimalSize.width,
								optimalSize.height);
						try { 
							camera.setParameters(params);
						} catch (RuntimeException ex) {
							ex.printStackTrace();
						} 
					} 
				} 
			} catch (IllegalArgumentException e) {
				e.printStackTrace();
			} catch (IllegalAccessException e) {