Java 将文件保存在Sd卡Android上的音乐目录中
如何将.mp3文件保存到SD卡上的音乐目录中 下面的代码总是将文件保存到下载文件夹中,不带任何扩展名Java 将文件保存在Sd卡Android上的音乐目录中,java,android,cordova,Java,Android,Cordova,如何将.mp3文件保存到SD卡上的音乐目录中 下面的代码总是将文件保存到下载文件夹中,不带任何扩展名 private FileOutputStream getOutStream(String fileName) throws FileNotFoundException{ if (Environment.getExternalStorageState().equals( Environment.MEDIA_MOUNTED)) { String
private FileOutputStream getOutStream(String fileName) throws FileNotFoundException{
if (Environment.getExternalStorageState().equals(
Environment.MEDIA_MOUNTED)) {
String sdpath = Environment.getExternalStorageDirectory()
+ "/";
mSavePath = sdpath + "download";
File file = new File(mSavePath);
if (!file.exists()) {
file.mkdir();
}
File saveFile = new File(mSavePath, fileName);
return new FileOutputStream(saveFile);
}else{
mSavePath = mContext.getFilesDir().getPath();
return mContext.openFileOutput(fileName , Context.MODE_WORLD_READABLE);
}
}
mSavePath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC);
File file = new File(mSavePath+"/filename.mp3");