无法将mp3文件保存在某些特定设备中 [英] Unable to save mp3 file in some specific device
本文介绍了无法将mp3文件保存在某些特定设备中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的项目中,我将此代码复制到mp3文件中
writefile
是复制文件的功能.
In my project I put this code to copy mp3 file
here writefile
is the function that copies file.
代码在装有Android 5.1的Moto G以外的设备上正常工作
code is correctly working on devices except Moto G with Android 5.1
p_name = mp_name.concat(".mp3");
InputStream inputStream = null;
try {
inputStream = getResources().openRawResource(mpTrake[id]);
byte[] reader = new byte[inputStream.available()];
while (inputStream.read(reader) != -1) {
}
writefile(reader, "/sdcard/" + mp_name);
Log.i("setring", "success");
} catch (IOException e) {
Log.i("setring", e.getMessage());
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e) {
Log.i("setring", e.getMessage());
}
}
}
推荐答案
可能是文件路径问题如果您将路径设置为\sdcard\
,但手机未插入SD卡,则会出现错误
May be is file path problem If you have set path to \sdcard\
but phone has not inserted sd card then you get errors
这篇关于无法将mp3文件保存在某些特定设备中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文