如何使用默认库应用程序来查看存储在绘制文件夹的图像? [英] How to use default gallery app to view images stored in drawable folder?

查看:69
本文介绍了如何使用默认库应用程序来查看存储在绘制文件夹的图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要做到这一点,我用下面的code,但它抛出ActivityNotFoundException ...

 字符串uriStr =android.resource://+com.soft.usegallery+/+ R.drawable.icon;
                 开放的我们的uri = Uri.parse(uriStr);
                 意向意图=新的意图();
                   intent.setAction(Intent.ACTION_VIEW);
                   intent.setDataAndType(URI,图像/ *);
                   startActivity(意向);
 

解决方案

首先,没有单一的默认库的应用程序为Android。不同的设备可能包含不同的画廊的应用程序,有的可能没有这样的应用程序。

二,很少,如果有的话,应用程序支持 android.resource:// 方案,更何况是一个画廊的应用程序

请实现自己的图像浏览界面,多半是使用的GridView

To do so I'm using the following code but it Throws ActivityNotFoundException...

String uriStr = "android.resource://"+ "com.soft.usegallery"+ "/" +  R.drawable.icon;
                 Uri uri = Uri.parse(uriStr);
                 Intent intent = new Intent();
                   intent.setAction(Intent.ACTION_VIEW);
                   intent.setDataAndType(uri, "image/*");
                   startActivity(intent);   

解决方案

First, there is no single "default gallery app" for Android. Different devices will contain different "gallery apps", and some probably have no such app.

Second, few, if any, apps support the android.resource:// scheme, let alone a "gallery app".

Please implement your own image viewing UI, perhaps using a GridView.

这篇关于如何使用默认库应用程序来查看存储在绘制文件夹的图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆