capture Async And Save
suspend fun CaptureController.captureAsyncAndSave(contentResolver: ContentResolver, type: ImageType, fileName: String, addContentValues: (contentValues: ContentValues) -> Unit = {}): Result<Unit?>
Capture and save Image
capture and save Image use MediaStore
need permission android.Manifest.permission.WRITE_EXTERNAL_STORAGE if SDK < Q
also see CaptureController.captureAsync
Example usage:
val captureController = rememberCaptureController()
val uiScope = rememberCoroutineScope()
val context = LocalContext.current
// The content to be captured in to Bitmap
Column(
modifier = Modifier.capturable(captureController),
) {
// Composable content
}
Button(
onClick = {
scope.launch {
captureController.captureAsyncAndSave(
contentResolver = context.contentResolver,
fileName = "Ticket",
type = ImageType.PNG(100)
)
}
}) { ... }
Content copied to clipboard
Parameters
suspend fun <Error class: unknown class>.captureAsyncAndSave(fileName: String = "capture_shared", type: ImageType = ImageType.PNG(100)): <Error class: unknown class>
Capture and save Image
capture and save Image use PHPhotoLibrary
also see CaptureController.captureAsync
Example usage:
val captureController = rememberCaptureController()
val uiScope = rememberCoroutineScope()
val context = LocalContext.current
// The content to be captured in to Bitmap
Column(
modifier = Modifier.capturable(captureController),
) {
// Composable content
}
Button(
onClick = {
scope.launch {
captureController.captureAsyncAndSave(
fileName = "Ticket",
type = ImageType.PNG(100)
)
}
}) { ... }
Content copied to clipboard