I am using the API 2.1 and my debug shows a max zoom value of 15. The code here does not make the camera zoom. How do I get the camera to zoom?
camera = Camera.open();
Camera.Parameters parameters = camera.getParameters();
parameters.set("orientation", "portrait");
parameters.setWhiteBalance(Camera.Parameters.WHITE_BALANCE_TWILIGHT);
int zoom = parameters.getMaxZoom();
Log.d(TAG, "Zoom " + zoom);
parameters.setZoom(15);
camera.setParameters(parameters);
This functionality depends on your Android version.
The method parameters.getMaxZoom() has been appeared since: API Level 8 (Android 2.2), so if you use Android 2.1 this code won’t work.
And another thing. You should use your max zoom something like that parameters.setZoom(zoom); instead using constant parameters.setZoom(15);
Also you need to check that user’s device support zooming. You can do it like this (only for Android 2.2 and higher)
But as I know there are no standard API for setting zoom in Android 2.1 I am still investigating this question.