Code example for Camera.Parameters

Methods: get, set

0
	private static final int MIN_ZOOM = 0;
	private static final int MAX_ZOOM = 6;
 
	protected static void cameraZoom(Camera cam, int dir) {
		Parameters p = cam.getParameters();
		String zoomSupportedString = p.get("zoom-supported");
		if (zoomSupportedString != null && !Boolean.parseBoolean(zoomSupportedString))
			return; 
 
		int zoom = getZoom(p);
		p.set("zoom", adjustZoom(zoom + dir));
 
		cam.setParameters(p);
	} 
 
	private static int getZoom(Parameters p) {
		try { 
			return Integer.valueOf(p.get("zoom"));
		} catch (NumberFormatException e) {
			return 0; 
		} 
	}