由网友(妄念)分享简介:我想从我的应用程序复制一个MP3文件的 原材料 的文件夹中的 的/ mnt / SD卡 的,但我不知道这份工作。I want to copy a mp3 file from my app raw folder to /mnt/SDcard but i have no idea for this job.这是不可能的...
我想从我的应用程序复制一个MP3文件的 原材料 的文件夹中的 的/ mnt / SD卡 的,但我不知道这份工作。
I want to copy a mp3 file from my app raw folder to /mnt/SDcard but i have no idea for this job.
这是不可能的?
如果您有任何答案告诉我有关权限,那些codeS需求;
If you have any answer tell me about permissions that those codes needs;
感谢名单。
推荐答案
下面是你可以用做什么:
Here is what you can use to do that :
InputStream in = getResources().openRawResource(R.raw.myresource);
FileOutputStream out = new FileOutputStream(somePathOnSdCard);
byte[] buff = new byte[1024];
int read = 0;
try {
while ((read = in.read(buff)) > 0) {
out.write(buff, 0, read);
}
} finally {
in.close();
out.close();
}
相关推荐
最新文章