Code example for Camera.Parameters

Methods: getFlashMode, getSupportedFlashModes, setFlashMode

0
      Parameters parameters = mCamera.getParameters();
      if (parameters == null) {
    	  Log.d(TAG, "Y U NO HAVE CAMERA PARAMS!");
        return; 
      } 
      List<String> flashModes = parameters.getSupportedFlashModes();
      String flashMode = parameters.getFlashMode();
      // Check if camera flash exists 
      if (flashModes == null) {
    	  Log.d(TAG, "Y U NO HAVE FLASH!");
        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");
        }