Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// Pick Images Contract - Normally this is for all kind of files.
private val pickImages = registerForActivityResult(ActivityResultContracts.GetContent()) {uri ->
uri?.let {uri ->
imageView.setImageURI(uri)
}
}
// Calling GetContent contract
pickImageButton.setOnClickListener {
pickImages("image/*") // We want images, so we set the mimeType as "image/*"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.