Hi guys!

I also was a problem on my Hero.
But I found a solution.

05-28 21:58:58.058: ERROR/QualcommCameraHardware(37): Invalid camera
state QCS_IDLE: expecting QCS_PREVIEW_IN_PROGRESS, cannot start
autofocus!
05-28 21:58:58.059: DEBUG/CAM OPEN(2710): java.io.IOException:
autoFocus failed

>From state machine follows the solution:
1.) Start the Preview.
2.) After set the autoFocus.

Example:
@Override
        public void surfaceChanged(SurfaceHolder holder, int format, int
width, int height) {
                if(started) cam.stopPreview();
                Camera.Parameters params = cam.getParameters();
                        params.setPictureSize(width, height);
                        params.setPreviewSize(width, height);
                cam.setParameters(params);
                cam.startPreview();
                cam.autoFocus(this);
                started = true;
        }

@Override
        public void onAutoFocus(boolean success, Camera camera) {
                                /* .... */
        }

I hope someone helps.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to