使用Intent.ACTION_PICK具体路径 [英] Using Intent.ACTION_PICK for specific path

查看:1448
本文介绍了使用Intent.ACTION_PICK具体路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Android的画廊挑选图像。启动画廊很容易用于这一目的。

I am trying to use Android gallery to pick image. Launching gallery is easy for that purpose

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

但是,我需要来限制显示在像册具体路径上的设备的图像(即,显示只从一个文件夹图像)。这是可能做到怎么样?

However, I need to limit images that are shown in the gallery to specific path on device (i.e. to show images from single folder only). Is this possible to do and how?

推荐答案

对不起,没有这个是不可能的。

Sorry, no this is not possible.

另外您要使用此意向协议错误。按<一个href="http://developer.android.com/reference/android/content/Intent.html#ACTION_PICK">http://developer.android.com/reference/android/content/Intent.html#ACTION_PICK该协议预计,你把内容:URI的数据设置所需的机械手从选择

Also you are using this Intent protocol wrong. As per http://developer.android.com/reference/android/content/Intent.html#ACTION_PICK this protocol expects that you put the content: URI of the data set you want the picker to select from.

这就是说,你应该考虑ACTION_PICK德precated。现代动作ACTION_GET_CONTENT这是更好的支持;你会发现支持ACTION_PICK参差不齐和不一致的。不幸的是ACTION_GET_CONTENT也没有让你指定的目录中。

That said, you should consider ACTION_PICK deprecated. The modern action is ACTION_GET_CONTENT which is much better supported; you will find support of ACTION_PICK spotty and inconsistent. Unfortunately ACTION_GET_CONTENT also does not let you specify a directory.

这篇关于使用Intent.ACTION_PICK具体路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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