Disabling autofocus in android
Use FOCUS_MODE_INFINITY
or FOCUS_MODE_FIXED
. You can also use FOCUS_MODE_MACRO
, but this requires holding the phone very close to the scanned object.
On the other hand, the word "scanner" conjures up thoughts of barcodes and QR codes, so if you're not printing them as a full-size page, you might be better off with FOCUS_MODE_MACRO
.
You can set the desired focus mode Camera.Parameters.setFocusMode()
when you open the camera.
source to share
you can use mCamera.cancelAutoFocus();
Also, if you want to set a macro or other focus mode, write:
Camera.Parameters mParam = mCamera.getParameters(); mParam.setFocusMode(Camera.Parameters.FOCUS_MODE_MACRO); mCamera.setParameters(mParam);
All focus modes and camera options are available here :
source to share