get Current Flash Mode - Android android.hardware

Android examples for android.hardware:Flash

Description

get Current Flash Mode

Demo Code

import android.graphics.Bitmap;
import android.hardware.Camera;
import java.lang.reflect.Method;
import java.util.Collections;
import java.util.List;

public class Main{

    public static String getCurrentFlashMode(Camera camera) {
        Camera.Parameters params = camera.getParameters();
        try {/*from  ww w. j  a v  a2  s .c  o  m*/
            Method getModeMethod = params.getClass().getMethod(
                    "getFlashMode");
            return (String) getModeMethod.invoke(camera);
        } catch (Exception ex) {
            return null;
        }
    }

}

Related Tutorials