Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android How to preview an image, using its file path from SDcard, from my application

File is present in sdcard/image.jpg
I would like to create my own application (activity). On a button press, the image stored in the sdcard needs to be displayed using the built-in image viewer. On pressing the back button from the Image viewer, it should go back to my running application.

Need some help.

like image 566
Roy Samuel Avatar asked Sep 29 '10 11:09

Roy Samuel


1 Answers

you can create an Intent with proper uri and mimetype for this.

Intent i = new Intent(Intent.ACTION_VIEW);
i.setDataAndType(Uri.parse("file:///sdcard/image.jpg"), "image/jpeg");
startActivity(i);
like image 122
bhups Avatar answered Sep 27 '22 19:09

bhups