开发者

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.


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);


Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
photoPickerIntent.setType("image/*");
startActivityForResult(photoPickerIntent, 1);

This code use for display all images from your SD card

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜