Originally Posted by hazardland
On my device (mk16i) app takes pic seconds after the perfect focus was made, for example after tapping on desired area in preview of an object with letters, first it focuses perfectly on letters then it looses focus and after it takes picture.
Well I achieved perfect focus after trying various focus techniques.
To sum up:
1. I set camera focus mode to Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE
2. I add 400 point square with weight 100 for example in the centre as Camera.Area(new Rect (-200, -200, 200, 200), 100) to Metering Areas (by Camera.Parameters.setMeteringAreas)
3. Then I call Camera.autoFocus and wait for onAutoFocus callback in which I simply take picture
* In PictureCallback I do not call Camera.cancelAutoFocus because it messes with FOCUS_MODE_CONTINUOUS_PICTURE kind of
* Calling Camera.takePicture outside of callback Camera.autoFocus also misses perfect focus in FOCUS_MODE_CONTINUOUS_PICTURE but some documentations mention that you can call takePicture at any time if you see that camera is focused on the subject but it is not true without callback it moves focus a bit and ruins perfect moment
Source code and apk binary for testing is here https://github.com/hazardland/camera.android