Skip to content

Instantly share code, notes, and snippets.

@tdcolvin
Created January 31, 2023 11:20
Show Gist options
  • Save tdcolvin/15245cc69302180036c26f99c2bcc622 to your computer and use it in GitHub Desktop.
Save tdcolvin/15245cc69302180036c26f99c2bcc622 to your computer and use it in GitHub Desktop.
//The URI of the photo that the user has picked
var photoUri: Uri? by remember { mutableStateOf(null) }
//The launcher we will use for the PickVisualMedia contract.
//When .launch()ed, this will display the photo picker.
val launcher = rememberLauncherForActivityResult(ActivityResultContracts.PickVisualMedia()) { uri ->
//When the user has selected a photo, its URL is returned here
photoUri = uri
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment