Skip to content

Instantly share code, notes, and snippets.

@AdoraNwodo
Last active August 4, 2021 06:27
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save AdoraNwodo/72e24b06ebb6526328e64ca8393e7c2e to your computer and use it in GitHub Desktop.
Save AdoraNwodo/72e24b06ebb6526328e64ca8393e7c2e to your computer and use it in GitHub Desktop.
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == PICK_IMAGE_REQUEST && resultCode == Activity.RESULT_OK) {
if(data == null || data.data == null){
return
}
filePath = data.data
try {
val bitmap = MediaStore.Images.Media.getBitmap(contentResolver, filePath)
uploadImage.setImageBitmap(bitmap)
} catch (e: IOException) {
e.printStackTrace()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment