gpt4 book ai didi

android - 在 android 中通过 intent 浏览文件时排除 google drive 选项

转载 作者:太空狗 更新时间:2023-10-29 14:41:47 26 4
gpt4 key购买 nike

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

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) {
}

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

我怎样才能得到它,帮帮我。进阶致谢

最佳答案

I just want not to display the google drive option.

想要什么并不重要。您的用户想要什么很重要。您的某些用户可能希望从 Google 云端硬盘、本地网络上的文件服务器以及他们在其设备上配置的支持 ACTION_GET_CONTENT 的其他地方获取内容。

除此之外,一般来说,您无法控制 ACTION_GET_CONTENT 向用户提供哪些选项。

因此,如果您不希望 Google Drive 作为一个选项出现,请不要使用 ACTION_GET_CONTENT(或 ACTION_OPEN_DOCUMENTACTION_CREATE_DOCUMENT 等.).做点别的,比如集成 file-picker library .

关于android - 在 android 中通过 intent 浏览文件时排除 google drive 选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46861766/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com