Skip to content

Instantly share code, notes, and snippets.

@m-kikuchi777
Last active December 19, 2019 04:39
Show Gist options
  • Save m-kikuchi777/bff77cd162f6420cd53b8997481f9f9a to your computer and use it in GitHub Desktop.
Save m-kikuchi777/bff77cd162f6420cd53b8997481f9f9a to your computer and use it in GitHub Desktop.
Scoped Storage Read as Bitmap
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
ImageDecoder.decodeBitmap(ImageDecoder.createSource(contentResolver, uri))
} else {
contentResolver.openInputStream(uri)?.use { inputStream ->
BitmapFactory.decodeStream(inputStream)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment