3

i made Camera Preview using CameraSource in Android Studio

new CameraSource.Builder(this , detector).setAutoFocusEnabled(true).build();

as you can see i easliy set the Auto Focus Enabled.

i was just wondering if there is an easy way to enable/disable flashlight ?

Fadi A.
  • 93
  • 1
  • 10

1 Answers1

1

Just use this method:

.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH).build();

Edit:

This class was deprecated in API level 21. Google recommends using the new android.hardware.camera2 API for new applications.

In this thread you can see how to use: Turning on/off flash with Android camera2 API not working

Issamu
  • 46
  • 5