Android examples for android.hardware:Flash
set the camera's flash mode
import android.graphics.Bitmap; import android.hardware.Camera; import java.lang.reflect.Method; import java.util.Collections; import java.util.List; public class Main{ /** set the camera's flash mode. Returns true if successful, false if the Android API doesn't support setting flash modes. *///from w w w . ja va 2 s .co m public static boolean setFlashMode(Camera camera, String mode) { Camera.Parameters params = camera.getParameters(); try { Method flashModeMethod = params.getClass().getMethod( "setFlashMode", String.class); flashModeMethod.invoke(params, mode); camera.setParameters(params); return true; } catch (Exception ignored) { return false; } } }