File) { //use the image file } override fun onError(useCaseError: ImageCapture.UseCaseError, message: String, cause: Throwable?) { //handle error } } val photoFile = createFile(outputDirectory, FILENAME, PHOTO_EXTENSION) imageCapture.takePicture(photoFile, imageSaveListener)