Turn off auto focus in android

16,466

Solution 1

Use FOCUS_MODE_INFINITY or FOCUS_MODE_FIXED. You can also use FOCUS_MODE_MACRO, but that will require holding your phone quite close to the object you're scanning.

On a second thought, the word 'scanner' evokes thoughts of barcodes and QR codes, so unless you print them as full-size page, you actually might be better off with FOCUS_MODE_MACRO.

You can set the desired focus mode with Camera.Parameters.setFocusMode() when opening your camera.

Solution 2

You Can use mCamera.cancelAutoFocus();

Also if you want to set Macro or another Focus Mode, you shall write:

Camera.Parameters mParam = mCamera.getParameters();
mParam.setFocusMode(Camera.Parameters.FOCUS_MODE_MACRO);
mCamera.setParameters(mParam);

All the focus mode and Camera parameters are availble here:

Share:
16,466
user1302569
Author by

user1302569

Updated on June 04, 2022

Comments

  • user1302569
    user1302569 almost 2 years

    It is any way to turn off auto focus in camera in code my application. I want to check how my scanner work if phone has no auto focus, but in my phone I have that function.