如何打开一个对话框,列出所有的应用程序,可以打开一个给定的文件夹?
我试过以下code
意向意图=新意图(Intent.ACTION_GET_CONTENT);intent.setData(Uri.fromFile(Environment.getExternalStorageDirectory()));startActivity(Intent.createChooser(意向,打开文件夹));
它说:没有应用程序可以执行此操作。
我的设备有默认的文件管理器和应用程序AndroidZip(这些应用程序可以打开一个文件夹)。
解决方案它说:没有应用程序可以执行此操作。
这是不足为奇的。你是不是要求打开文件夹,因为没有这样的事情在意图
系统中的文件夹。您正在试图找出哪些应用程序可以打开的路径,没有文件扩展名并没有MIME类型。有没有在设备上安装应用程序有一个<意向滤光器>
在支持的活动 ACTION_GET_CONTENT
上有没有文件扩展名并没有MIME类型的路径。
您可以尝试 ACTION_VIEW
。但是,请记住,我估计,Android设备的90%以上将一无所有,在这种方式与文件夹交易,无论是。
How to open a dialog that list all applications that can open a given folder?
I tried following code
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setData(Uri.fromFile(Environment.getExternalStorageDirectory()));
startActivity(Intent.createChooser(intent, "Open Folder"));
it says "No applications can perform this action."
My device has default File Explorer and AndroidZip applications (these apps can open a folder).
解决方案it says "No applications can perform this action."
That is not surprising. You are not asking to open a "folder", as there is no such thing as a "folder" in the Intent
system. You are trying to find out what applications can open a path with no file extension and no MIME type. There are no applications installed on your device that have an <intent-filter>
on an activity that supports ACTION_GET_CONTENT
on a path with no file extension and no MIME type.
You might try ACTION_VIEW
. However, bear in mind that I would estimate that 90+% of Android devices will have nothing that deals with "folders" in this fashion, either.
相关推荐
最新文章