本文介绍了打开文件夹 - 意向选择器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何打开一个对话框,列出所有的应用程序,可以打开一个给定的文件夹?

我试过以下code

 意向意图=新意图(Intent.ACTION_GET_CONTENT);
intent.setData(Uri.fromFile(Environment.getExternalStorageDirectory()));
startActivity(Intent.createChooser(意向,打开文件夹));

它说:没有应用程序可以执行此操作。

我的设备有默认的文件管理器和应用程序AndroidZip(这些应用程序可以打开一个文件夹)。


解决方案

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.

这篇关于打开文件夹 - 意向选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 16:34
查看更多