閃光燈
val imageCaptureConfig = ImageCaptureConfig.Builder().apply {//在config裏面設置
setLensFacing(lensFacing)
setCaptureMode(ImageCapture.CaptureMode.MIN_LATENCY)
setFlashMode(flashMode)
setTargetRotation(texture_view.display.rotation)
}.build()
FlashMode.AUTO/FlashMode.OFF/FlashMode.ON
有這三種模式。
打開系統相冊
在點擊事件中
val intent = Intent()
intent.type = "image/*"
intent.action = Intent.ACTION_GET_CONTENT
startActivityForResult(intent, REQUEST_CODE_SELECT_PHOTO)
並重寫在點擊事件所在的Activity的onActivityResult
if (resultCode == Activity.RESULT_OK) {
if (requestCode == REQUEST_CODE_SELECT_PHOTO) {
//todo
}
}