Last active
June 11, 2020 09:35
-
-
Save anoopmaddasseri/8728395744fd5892d16d9d4a81dec8fb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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