user1302569
user1302569

Reputation: 7191

Turn off auto focus in android

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.

Upvotes: 4

Views: 18339

Answers (2)

DaviF
DaviF

Reputation: 377

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:

Upvotes: 0

Franci Penov
Franci Penov

Reputation: 75991

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.

Upvotes: 2

Related Questions