Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Solution is use a JavaCameraView ! In class JavaCameraView insert this functions with this body.

    public void turnOffTheFlash() {
       Camera.Parameters params = mCamera.getParameters();
       params.setFlashMode(params.FLASH_MODE_OFF);
       mCamera.setParameters(params);
    }

    public void turnOnTheFlash() {
       Camera.Parameters params = mCamera.getParameters();
       params.setFlashMode(params.FLASH_MODE_TORCH);
       mCamera.setParameters(params);
    }

Then in your activity class create instance of JavaCameraView class, for example private JavaCameraView mOpenCvCameraView;. Finally with this instance call these functions like this.

mOpenCvCameraView.turnOnTheFlash();

or

mOpenCvCameraView.turnOffTheFlash();