What codes to use to zoom in on the camera?

Asked

Viewed 67 times

3

My group is making an app with camera. Only we don’t know what code to use to add zoom into the camera. Does anyone know how to do?

1 answer

1

This below will work if the user’s Android is:

  • API 8 +

   Camera.Parameters parameters = camera.getParameters();
   int maxZoom = parameters.getMaxZoom(); 
      if (parameters.isZoomSupported()) {
        if (zoom >=0 && zoom < maxZoom) {
         parameters.setZoom(zoom);
      } else {
        // zoom parameter incorreto
      }
     }

Browser other questions tagged

You are not signed in. Login or sign up in order to post.