Android- how can I convert android.net.Uri object to java.net.URI object?
<p>Thanks for any help.</p>

<p>I am trying to get a FileInputStream object on an image that the user selects from the picture gallery. This is the android URI returned by android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI</p>

<p>content://media/external/images/media/3</p>

<p>When I try to construct a java URI object from this object, I get an IllegalArgumentException with the exception description <strong>Expected file scheme in URI: content://media/external/images/media/3</strong> whereas the android URI shows the scheme as <strong>content</strong></p>

<p>Never found a solution for the original question. But if you want the byte stream of an image in the pictures gallery, this piece of code will do that.</p>

<pre><code>Bitmap bitmap = Media.getBitmap(getContentResolver(), imageUri);
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 40, bytes);
ByteArrayInputStream fileInputStream = new ByteArrayInputStream(bytes.toByteArray());
</code></pre>
