我目前正在使用这段代码 -
fileName = recordings.get(position);
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
File file1 = new File(file.getAbsolutePath()+"/"+fileName);
intent.setDataAndType(Uri.fromFile(file1), "audio/*");
startActivity(intent);
但我从 Google 播放音乐中收到一条提示“无法播放您请求的轨道”
最佳答案
是的,您的应用程序可以访问自己的私有(private)内部存储器。但其他应用程序则不能。因此,如果其他应用程序必须播放音频文件,请勿将其放在那里。
也许内容提供商可以实现这一点。
关于java - 如何播放存储在我的应用程序数据文件夹中的音频文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28833486/