Galaxy S4 will turn on the flash-flash of the camera onPictureTaken can not be called

I have a very annoyed error on the Galaxy S4 (another device works fine): when I turn on the flash, I can’t take a picture because it is onPictureTakenn’t called. Here is my attempt:

  private void changeFlashMode(boolean isFlashOn) {
    if (mCamera != null) {          
        // assume I 've already checked support flash mode
        Camera.Parameters camParameters = mCamera.getParameters();
        camParameters.setFlashMode(isFlashOn ? Parameters.FLASH_MODE_ON : Parameters.FLASH_MODE_OFF);
        mCamera.setParameters(camParameters);
        startCameraPreview();        
    }
}

Debugging, I see that it is called on this line:

mCamera.takePicture(null, null, null, this);

and then nothing happened, onPictureTakennot called.

Could you give me an example?

+3
source share

All Articles