我正在开发一个打开文件夹的Android应用程序,
我的问题是如何在 Android 中以编程方式打开文件夹? 。
我尝试了 stack-overflow 中提供的所有解决方案并在 Google 中搜索,但找不到解决方案。有人可以给我答案吗?
提前致谢。
您可以使用以下代码打开文件夹
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);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)