如何显示“内部存储"默认情况下,ActionOpenDocument意向中的选项 [英] How to show the "internal storage" option in an ActionOpenDocument intent by default

查看:93
本文介绍了如何显示“内部存储"默认情况下,ActionOpenDocument意向中的选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要用户选择自定义文件类型的文件,该文件已从Windows文件资源管理器拖到其android设备上,但是默认情况下内部存储选项不可用.

I need the user to select a file of a custom filetype that they've dragged onto their android device from windows file explorer, but the internal storage option isn't available by default.

当我使用此方法启动意图时:

When I launch the intent using this:

var libraryIntent = new Intent(Intent.ActionOpenDocument);
libraryIntent.SetType("application/*");
_activity.StartActivityForResult(libraryIntent, (int)ActivityRequestCode.ImportFeatureCodeLibrary);

Android OS(5.1和6.0)显示以下屏幕:

Android OS (5.1 and 6.0) shows the following screen:

用户必须知道转到右上角的按钮,然后选择显示内部文件存储的选项:

The user has to know to go to the button in the top right and select the option to show internal file storage:

他们必须再次单击汉堡包,然后汉堡包才会显示在列表中:

They have to click the hamburger again and only then does it show up in the list:

是否有一种方法可以使该选项默认显示在列表中,或者更好的方法是让用户进入内部存储"文件选择器?

Is there a way to have this option show up in the list by default, or even better to have the user dropped into the "internal storage" file picker?

推荐答案

您可以在intent中添加其他内容:

You can add an extra to the intent :

libraryIntent.PutExtra("android.content.extra.SHOW_ADVANCED", true);

据我所知,这是一个未记录的额外内容,但是它可以从API 19到至少26正常工作

As far as I know it's an undocumented extra, but it seams to work from API 19 to at least 26

这篇关于如何显示“内部存储"默认情况下,ActionOpenDocument意向中的选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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