按钮开始在Android图库

按钮开始在Android图库

本文介绍了按钮开始在Android图库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让我的应用程序打开内置的画廊按钮。

 公共无效的onClick(视图v){
                意图int​​entBrowseFiles =新意图(Intent.ACTION_VIEW);
                intentBrowseFiles.setType(图像/ *);
                intentBrowseFiles.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                startActivity(intentBrowseFiles);
            }

这将导致一个错误消息应用程序相机(进程com.android.gallery)意外停止。

如果我设置了意向行动ACTION_GET_CONTENT它设法打开图片库,但随后当选择一个图片是不是我想要的图像简单地返回到我的应用程序。


解决方案

Your question subject says "Gallery". Your first sentence in the question says "browser". These are not the same thing.

Of course, actually telling us "what [you] want" would just be too useful, so you are making us guess.

I am going to go out on a limb and guess that you are trying to open the Gallery application just as a normal application. Note that there is no Gallery application in the Android OS. There may or may not be a Gallery application on any given device, and it may or may not be one from the Android open source project.

However, for devices that have the Android Market on them, they should support an ACTION_VIEW Intent with a MIME type obtained from android.provider.MediaStore.Images.Media.CONTENT_TYPE.

这篇关于按钮开始在Android图库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 12:51