3

I'm using the commonsware camera library. My pictures look great, but when I get close to something I want to re-focus, but I haven't been able to do that. I have followed some of the read me documentation as seen here:

You can call autoFocus() on CameraFragment or CameraView to trigger any auto-focus behavior that you have configured via setFocusMode() on Camera.Parameters. You can call cancelAutoFocus() on CameraFragment or CameraView to ensure that auto-focus mode has been canceled.

I'm simply doing an onclicklistener on the screen, and want it to focus again, so that my picture is clear. Has anyone been successful in doing this?

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
c_idle
  • 1,448
  • 4
  • 22
  • 40
  • "My pictures look great" -- who-hoo! :-) "I'm simply doing an onclicklistener on the screen, and want it to focus again, so that my picture is clear" -- and what specifically are you doing in the listener? – CommonsWare Sep 30 '13 at 16:10
  • I'm calling autoFocus() – c_idle Sep 30 '13 at 16:10
  • 1
    :: shrug :: All I am doing is passing the calls to the underlying `Camera` object. You could try `cancelAutoFocus()`, followed by another `autoFocus()`. – CommonsWare Sep 30 '13 at 16:12
  • Hah. That shrug. Thanks I will try that and let you know, give me a sec! – c_idle Sep 30 '13 at 16:16

1 Answers1

5

Apparently, you need to cancelAutoFocus() before you can trigger autoFocus() again to get a fresh autofocus.

I have filed an issue with, um, myself, to consider a better API here.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491