Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@Composable
fun PhotoPickerResultComposable() {
var result by rememberSaveable { mutableStateOf<Uri?>(null) }
val launcher =
rememberLauncherForActivityResult(ActivityResultContracts.StartActivityForResult()) {
result = it.data?.data
}
Column(
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {
OpenPhotoPicker(openLauncher = { launcher.launch(photoIntent) })
AsyncImage(
model = result,
contentDescription = "Image from photo picker",
contentScale = ContentScale.Crop,
modifier = Modifier
.size(200.dp, 200.dp)
.clip(CircleShape)
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment