开发者

Opening Image File gives error in Android

开发者 https://www.devze.com 2023-03-20 19:14 出处:网络
I am trying to open a jpg image file in gallery. This gives a error. I am using the code below Intent intent = new Intent();

I am trying to open a jpg image file in gallery. This gives a error. I am using the code below

Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse("/mnt/sdcard/image123.jpg"),"image/jpeg");
startActivityForResult(intent, 900);

This gives a option to open file in gallery. I select Gallery from the list. But it does not open up. I use ASTRO file manager and open the same image f开发者_JAVA百科ile. It opens up fine now. Please let me know if something is wrong.


Where do you got /mnt/sdcard. Try Environment.getExternalStorageDirectory().getAbsolutePath() instead.


Specified Image Path? You can't.

Please Refer My Question as How to access different File Manager specific path. Refer this link and then you got a answer.

0

精彩评论

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