Launch intent viewer to display image from url

Posted by Savvas Dalkitsis on Stack Overflow See other posts from Stack Overflow or by Savvas Dalkitsis
Published on 2010-06-01T16:43:52Z Indexed on 2010/06/01 17:33 UTC
Read the original article Hit count: 318

Filed under:
|
|
|

I have the url of an image. What i need to do is launch the default image viewer for images using an intent.

I tried launching it by using:

Uri uri = Uri.parse("http://www.google.com/intl/en_ALL/images/srpr/logo1w.png");  
Intent it = new Intent(Intent.ACTION_VIEW);
it.setDataAndType(uri, "image/*")
startActivity(it);

But it doesn't work. If I do not specify the type of data, the intent launches the browser since the data is a url. It works basically (since you can see the image on the browser) but what I would like is to have the gallery display the image for me.

I can also download the image into a Bitmap but I would still not know how to display the Bitmap using the gallery (if that's even possible). Any ideas?

© Stack Overflow or respective owner

Related posts about java

Related posts about android