Search code examples
javacameraandroid-5.0-lollipop

Android 5, camera2 use only flash


I need to use only the flash with the API camera2 (Android 5, API level 21), like torch applications. But all the examples that I found requires the display of camera stream in a view


Solution

  • https://github.com/pinguo-yuyidong/Camera2/blob/master/app/src/main/java/us/yydcdut/androidltest/otheractivity/FlashActivity.java
    here,you don't need the preview to open the flash.