Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8990551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:31:29+00:00 2026-06-15T22:31:29+00:00

I have a button on my camera preview screen to toggle the camera’s flash.

  • 0

I have a button on my camera preview screen to toggle the camera’s flash. The camera starts on auto-flash which works then when the button is pressed the flash turns off but when i try to turn the flash back on it doesn’t turn on and i don’t know why?

Log.d("flash",mCamera.getParameters().getFlashMode());

Displays on off and auto as i press it. But it doesn’t turn back on. Here is my full code

public void flashPressed(View v)
{
    ImageButton flashButton = (ImageButton)findViewById(R.id.flash);
    Camera.Parameters myP = mCamera.getParameters();
    if(flashOn == 0)
    {
        flashButton.setImageResource(R.drawable.device_access_flash_off);

        myP.setFlashMode(Camera.Parameters.FLASH_MODE_OFF);
        flashOn = 1;

    }
    else if(flashOn == 1)
    {
        myP.setFlashMode(Camera.Parameters.FLASH_MODE_ON);
        flashButton.setImageResource(R.drawable.device_access_flash_on);
        flashOn=2;
    }else{
        myP.setFlashMode(Camera.Parameters.FLASH_MODE_AUTO);
        flashButton.setImageResource(R.drawable.device_access_flash_automatic);
        flashOn =0;
    }

    mCamera.setParameters(myP);
    Log.d("flash",mCamera.getParameters().getFlashMode());
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T22:31:31+00:00Added an answer on June 15, 2026 at 10:31 pm

    To avoid this problem I just created a new camera each time the flash option changes

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a blank screen on which i click camera button and take photo
i am making a app which takes photo on button click i have camera.java
Is it possible to have a split screen that would have a camera preview
I have a Button Add. which will add images from Gallery and Camera. I
I have a surfaceview which is displaying a camera preview I have it taking
I have a Droid X, which has a physical camera button. I am using
So I'm trying to have a button where users can choose between flash on/off/auto.
For example I have an app that counts how many time Camera button was
I have button which post values of form to url but during post i
I have button, which fires an event, that deletes a record from the database.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.