相关疑难解决方法(0)

在android中通过意图浏览文件时排除谷歌驱动器选项

这是一个被问到的问题,但我没有使用该解决方案解决它。这是我的代码

Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
Uri uri = Uri.parse(Environment.getDownloadCacheDirectory().getPath().toString());
intent.setDataAndType(uri,"*/*");
intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
intent.addCategory(Intent.CATEGORY_OPENABLE);
try {
    startActivityForResult(Intent.createChooser(intent, "SELECT FILE"), commonUtilities.FILE_REQUEST_CODE);
} catch (ActivityNotFoundException e) {
}
Run Code Online (Sandbox Code Playgroud)

谷歌驱动器选项仍然存在。我只是不想显示谷歌驱动器选项。

我怎样才能得到它,帮帮我。感谢广告

android filechooser google-drive-api

5
推荐指数
1
解决办法
1346
查看次数

Android:为什么Intent.EXTRA_LOCAL_ONLY会显示Google相册

我在我的应用程序中尝试做的是让用户从他手机的图库中选择一张图片(不想只获取图库图片,还允许用户选择他们选择的应用程序).我正在使用的代码如下:

Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
startActivityForResult(Intent.createChooser(intent, "Select Picture"), 1);
Run Code Online (Sandbox Code Playgroud)

根据Intent.EXTRA_LOCAL_ONLY不起作用

EXTRA_LOCAL_ONLY仅告知接收应用程序它应该只返回存在的数据.

添加intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);上面的代码后,它隐藏了谷歌驱动器应用程序picasa应用程序,但仍显示谷歌照片(这些照片不在我的设备中.)

此外,我只为本地文件尝试了Android图像选择器,但它隐藏了所有具有远程图像的应用程序,不包括谷歌照片.

注意:所有图像路径都是正确的,因为我在KitKat上的Android Gallery为Intent.ACTION_GET_CONTENT返回不同的Uri(感谢@Paul Burke),但我不想选择互联网/远程图像.

所以我的问题是否有任何方法隐藏谷歌照片应用程序,只从本地设备选择图像.或谷歌照片是否属于Intent.EXTRA_LOCAL_ONLY

android android-gallery

3
推荐指数
1
解决办法
6989
查看次数