Skip to content

Instantly share code, notes, and snippets.

@navczydev
Created June 10, 2022 02:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save navczydev/d35fa64dbe22977f8798adac3368288d to your computer and use it in GitHub Desktop.
Save navczydev/d35fa64dbe22977f8798adac3368288d to your computer and use it in GitHub Desktop.
@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