Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save anoopmaddasseri/8728395744fd5892d16d9d4a81dec8fb to your computer and use it in GitHub Desktop.
Save anoopmaddasseri/8728395744fd5892d16d9d4a81dec8fb to your computer and use it in GitHub Desktop.
val getContent = registerForActivityResult(GetContent()) { uri: Uri? ->
// Handle the returned Uri
}
override fun onCreate(savedInstanceState: Bundle?) {
// ...
val selectButton = findViewById<Button>(R.id.select_button)
selectButton.setOnClickListener {
// Pass in the mime type you'd like to allow the user to select
// as the input
getContent.launch("image/*")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment