简体   繁体   English

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

[英]exclude the google drive option in browsing files through intent in android

this is a asked question but i did not solve it using that solution.这是一个被问到的问题,但我没有使用该解决方案解决它。 Here is my code这是我的代码

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

Still Google drive options is there.谷歌驱动器选项仍然存在。 I just want not to display the google drive option.我只是不想显示谷歌驱动器选项。

How can i get that , Help me out.我怎样才能得到它,帮帮我。 Thank in adv感谢广告

I just want not to display the google drive option.我只是不想显示谷歌驱动器选项。

What you want is not important.想要什么并不重要。 What your users want is important.您的用户想要什么很重要。 Some of your users may want to get content from Google Drive, file servers on the local network, and other places that they have configured on their device that support ACTION_GET_CONTENT .您的某些用户可能希望从 Google Drive、本地网络上的文件服务器以及他们在设备上配置的支持ACTION_GET_CONTENT其他地方获取内容。

Beyond that, in general, you cannot control what options ACTION_GET_CONTENT provides to users.除此之外,一般来说,您无法控制ACTION_GET_CONTENT为用户提供的选项。

So, if you do not want Google Drive to appear as an option, do not use ACTION_GET_CONTENT (or ACTION_OPEN_DOCUMENT , ACTION_CREATE_DOCUMENT , etc.).因此,如果您不希望 Google Drive 作为选项出现,请不要使用ACTION_GET_CONTENT (或ACTION_OPEN_DOCUMENTACTION_CREATE_DOCUMENT等)。 Do something else, such as integrate a file-picker library .做其他事情,例如集成文件选择器库

  Intent galleryIntent = new Intent(Intent.ACTION_PICK,
            android.provider.MediaStore.Video.Media.EXTERNAL_CONTENT_URI);

    startActivityForResult(Intent.createChooser(galleryIntent, 
    getString(R.string.label_select_video)), REQUEST_VIDEO_TRIMMER);

try this is working for me.试试这对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM