Android examples for android.hardware:Camera Feature
Is camera In Torch 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{ /** Returns true if the camera is in torch mode (flash always on) */ public static boolean cameraInTorchMode(Camera camera) { return "torch".equals(getCurrentFlashMode(camera)); }/*from w w w.j a va 2s. c om*/ public static String getCurrentFlashMode(Camera camera) { Camera.Parameters params = camera.getParameters(); try { Method getModeMethod = params.getClass().getMethod( "getFlashMode"); return (String) getModeMethod.invoke(camera); } catch (Exception ex) { return null; } } }