Android examples for Camera:Camera Zoom
exec Camera Zoom
import android.hardware.Camera; public class Main { /**//from w w w . j a va 2 s . c o m * * @param camera * @param zoom * @return */ public static boolean execZoom(final Camera camera, int zoom) { final Camera.Parameters params = camera.getParameters(); if (enableZoom(camera)) { if (params.getMaxZoom() >= zoom && zoom > -1) { params.setZoom(zoom); camera.setParameters(params); return true; } } return false; } /** * * @param zoom * @return */ public boolean execZoom(final int zoom) { return execZoom(zoom); } /** * * @param camera * @return */ public static boolean enableZoom(final Camera camera) { final Camera.Parameters params = camera.getParameters(); return params.isZoomSupported(); } }