Jakub Bober
unread,Jun 6, 2022, 4:39:44 AM6/6/22Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Android CameraX Discussion Group
I have tis fun to take photo
private fun takePhoto(): Boolean {
mediaPlayer.start()
// Get a stable reference of the modifiable image capture use case
val imageCapture = imageCapture ?: return false
imageCapture.
val nameFile = getFormatFile02(getString(R.string.app_name).lowercase())
val contentValues = getContentValuesFileName(nameFile,
actualCameraDimensionSelect.width,
actualCameraDimensionSelect.height)
//var tezt = imageCapture.
// Create the output file option to store the captured image in MediaStore
val outputFileOptions = ImageCapture.OutputFileOptions
.Builder(contentResolver,
MediaStore.Images.Media.EXTERNAL_CONTENT_URI, contentValues)
.build()
// Set up image capture listener, which is triggered after photo has
been taken
imageCapture.takePicture(outputFileOptions,
ContextCompat.getMainExecutor(this), object :
ImageCapture.OnImageSavedCallback {
override fun onError(exc: ImageCaptureException) {
showSnackBar(resources.getString(R.string.photo_capture_failed),
fontTextSize, Snackbar.LENGTH_LONG, numberRow = 2)
}
override fun onImageSaved(output: ImageCapture.OutputFileResults) {
showSnackBar(nameFile, fontTextSize, Snackbar.LENGTH_SHORT,
numberRow = 7)
}
})
return true
}
How to add tezt to the picture object ImageCapture?
Thanks for answer
Jakub