SetOneShotPreviewCallback () only called once in the loop

advertisements

I have the following code:

    for (int ii = 0; ii < nOfPictures; ii++){
            mCamera.startPreview();
            mCamera.setOneShotPreviewCallback(this);
    }

However, setOneShotPreviewCallback() only gets called once. I run it in debugging mode and it stops at the breakpoint of the method call during every iteration, but stops only once in the breakpoint located in OnPreviewFrame().

It also appears setOneShotPreviewCallback() is on the same thread as the loop, if that is helpful.


Yes. Per the setOneShotPreviewCallback() javadoc,

Installs a callback to be invoked for the next preview frame in addition to displaying it on the screen. After one invocation, the callback is cleared. This method can be called any time, even when preview is live. Any other preview callbacks are overridden.