How to know if android device has front flash

695 views Asked by At

I want to know if device supports front flash. I got the camera list from the camera manager and tried to get the front camera. How do I get the front camera if "Camera" is deprecated and how to know if it supports flash?

    import android.annotation.TargetApi;
    import android.app.Activity;
    import android.content.Context;
    import android.hardware.camera2.CameraAccessException;
    import android.hardware.camera2.CameraManager;
    import android.os.Bundle;


    public class MainActivity extends Activity {
        boolean x;
        String[] CameraList;

        @TargetApi(23)
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            CameraManager cameraManager= (CameraManager) getSys

temService(Context.CAMERA_SERVICE);
        try {
            //got the camera list-it's length is 2
          CameraList=cameraManager.getCameraIdList();
        } catch (CameraAccessException e) {
            e.printStackTrace();
        }



    }


}
0

There are 0 answers