问题描述
我试图让我的应用程序打开内置的画廊按钮。
公共无效的onClick(视图v){
意图intentBrowseFiles =新意图(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图库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!