Question

I have a png and a jpg image on disk. I'd like to use any built-in intent (if any are available) to view the image (just a single one at a time). Something like this:

Intent intent = new Intent();
intent.setImagePath("/blah/myimage.jpg");
startActivity(intent);

is there a built-in intent in android to do this, or do I have to write my own image viewing-activity? It would be cool if there was one that had panning/zooming as found in WebView,

Thanks

Was it helpful?

Solution

This should work.

 Uri uri = Uri.fromFile("/blah/myimage.jpg"); 
 Intent intent = new Intent(android.content.Intent.ACTION_VIEW); 
 intent.setDataAndType(uri, "image/jpg"); 
 startActivity(intent);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow