Created
May 1, 2020 23:50
-
-
Save wajahatkarim3/c7a71093924384bc1ed3d2e608a62d41 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// 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