我正在 android studio 中开发视频转换器。我能够成功转换文件并可以播放生成的文件:
File file = new File(filepath);
Uri path = Uri.fromFile(file);
Intent Openintent = new Intent(Intent.ACTION_VIEW);
Openintent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Openintent.setDataAndType(path, "audio/mp3");
try {
startActivity(Openintent);
}
catch (ActivityNotFoundException e) {
}
但我找不到任何代码来打开生成的文件夹并显示已标记的转换文件。就像我们在 Windows 中一样 Locate file in folder
。
最佳答案
这里是打开转换文件所在文件夹的方法
String folderPath = filepath.substring(0 , filepath.lastIndexOf('/') + 1);
Uri uri = Uri.parse(folderPath);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(uri, "resource/folder");
startActivity(intent);
关于java - 在 Activity 中显示转换后的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53985135/