I created and stored an image like this:
val values = ContentValues(2)
values.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg")
values.put(MediaStore.Images.Media.RELATIVE_PATH, Environment.DIRECTORY_DCIM)
picUri = contentResolver.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values)
Intent(MediaStore.ACTION_IMAGE_CAPTURE).also { takePictureIntent ->
takePictureIntent.resolveActivity(packageManager)?.also {
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, picUri )
startActivityForResult(takePictureIntent, CAMERA_CAPTURE)
}
}
Then I have to reuse this pic later. I need to feed its content into a WebResourceResponse
in a custom WebViewClient::shouldInterceptRequest()
I need an input stream to do a return WebResourceResponse("image/jpeg", "utf-8", inputStream)
The path looks like this: /external/images/media/40
How do I get an inputStream from a content://external/images/media/40
uri?
Or how do I request the MediaStore so it finds my pic?