Last active
December 19, 2019 04:39
-
-
Save m-kikuchi777/bff77cd162f6420cd53b8997481f9f9a to your computer and use it in GitHub Desktop.
Scoped Storage Read as Bitmap
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
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