Code example for Camera.Parameters

Methods: getFlashMode, getSupportedFlashModes, setFlashMode

2
Parameters parameters = mCamera.getParameters();
            if (parameters == null) {
                return; 
            } 
            List<String> flashModes = parameters.getSupportedFlashModes();
            String flashMode = parameters.getFlashMode();
            // Check if camera flash exists 
            if (flashModes == null) {
                return; 
            } 
            Log.i(TAG, "Flash mode: " + flashMode);
            Log.i(TAG, "Flash modes: " + flashModes);
            if (!Parameters.FLASH_MODE_OFF.equals(flashMode)) {
                // Turn off the flash 
                if (flashModes.contains(Parameters.FLASH_MODE_OFF)) {
                    parameters.setFlashMode(Parameters.FLASH_MODE_OFF);
                    mCamera.setParameters(parameters);
                    stopWakeLock(); 
                } else { 
                    Log.e(TAG, "FLASH_MODE_OFF not supported");
                }