Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Flash in custom camera android

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 413
    Comment on it

    I am writing the code that we use to implement the flash in custom camera.

    First, we need Camera.Parameters object that we get from Camersa's getParameters() method.

    Then by using Camera.Parameters's setFlashMode() method we can specify our requirement.
    We can use  either FLASH_MODE_ON, FLASH_MODE_OFF or FLASH_MODE_AUTO properties.

     

    Below is the code:

     private void setFlashOnOff(boolean flash) {
            if (flash) {
                Camera.Parameters params = mCamera.getParameters();
                params.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH);
                
                mCamera.setParameters(params);
            } else {
                Camera.Parameters params = mCamera.getParameters();
                params.setFlashMode(Camera.Parameters.FLASH_MODE_OFF);
                mCamera.setParameters(params);
              
    
            }
        }

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: