Skip to content Skip to sidebar Skip to footer

Android Camera , Onpicturetaken(byte[] Imgdata, Camera Camera) Method & Picturecallback Never Called

I have a custom camera app , that previews the camera video output on SurfaceView and attempts to take pictures , the pics should be will be processed by “xzing “scanner API t

Solution 1:

The only thing I can find that might be the culprit is that you're starting the preview again before the jpegCallback has returned. According to the javadoc, this is not allowed:

After calling this method, you must not call startPreview() or take another picture until the JPEG callback has returned.

The callback is actually put on the UI thread queue - which will be suspended in your Thread.sleep() and the same thread will have called stopPreview() and startPreview() before actually coming to the callback. Generally speaking, if you call Thread.sleep() on the UI thread - you're doing it wrong. So, hopefully if you remove the sleep() and put what comes after it in the jpegCallback your problem should be solved.

Post a Comment for "Android Camera , Onpicturetaken(byte[] Imgdata, Camera Camera) Method & Picturecallback Never Called"