I use this snippet to make camera focus on document:
// set focus mode is auto
List<String> supportModes = parameters.getSupportedFocusModes();
// find appreciate focus mode. In this case, the focus mode is 'auto'
camParameters.setFocusMode(focusmode);
camera.autoFocus(new Camera.AutoFocusCallback() {
@Override
public void onAutoFocus(boolean success, Camera camera) {
// do something after focusing
}
});
I put the autoFocus
method in a timer, it 's called with 5 seconds interval. My code worked fine on many devices (Galaxy ace, note 3, S3...) except Galaxy S4. From debug, I can see onAutoFocus
callback get called, but there is nothing happened with camera and surface view. Camera doesn't focus on anything. The image on surface view is very blur. Does anyone know this bug?