我正在开发一个Android应用程序,它可以打开文件夹。我的问题是如何在Android中以编程方式打开文件夹?我尝试了stackoverflow上的所有解决方案并在谷歌上搜索,但是我找不到解决办法。请问是否有人能提供一个答案呢?谢谢。
你可以使用以下代码打开文件夹
File file = new File(path);
Uri uri_path = Uri.fromFile(file);
String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension
(MimeTypeMap.getFileExtensionFromUrl(path));
Intent intent = new Intent(android.content.Intent.ACTION_VIEW);
intent.setType(mimeType);
intent.setDataAndType(uri_path, mimeType);
startActivity(intent);