Skip to content

Instantly share code, notes, and snippets.

@nikit19
Created February 12, 2022 11:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikit19/4fb1d225affcde26147a37e9e3577df2 to your computer and use it in GitHub Desktop.
Save nikit19/4fb1d225affcde26147a37e9e3577df2 to your computer and use it in GitHub Desktop.
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (resultCode == RESULT_OK) {
when (requestCode) {
REQUEST_CODE_SINGLE_SELECT -> {
val uri = data?.data
// Do stuff with uri
}
REQUEST_CODE_MULTI_SELECT -> {
var mediaCount = 0
while (mediaCount < data?.clipData!!.itemCount) {
val uri = data.clipData!!.getItemAt(mediaCount).uri
// Do stuff with uri
mediaCount++
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment