Android项目中有一个.pcm格式的音频文件,如何在代码中把它保存到手机内存某一路径里
在项目的哪个目录,deploy就在哪个目录,用相对路径读取就可以了,不用放到手机内存
读取后,再存到手机目录里;一般直接读取用就可以了;
/**
* 获取歌曲的名称
*/
private void getMusicFile()
{
cursor = this.getContentResolver().query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, new String[]{MediaStore.Audio.Media.DATA, MediaStore.Audio.Media.TITLE}, null, null, null);
if(cursor == null || cursor.getCount() == 0)
{
txt.setText("没有音乐文件");
}
paths = new String[cursor.getCount()];
titles = new String[cursor.getCount()];
cursor.moveToFirst();
for(int i = 0; i < cursor.getCount(); i ++)
{
paths[i] = cursor.getString(0);
titles[i] = cursor.getString(1);
cursor.moveToNext();
}
}
这是从手机内存卡中读取歌曲文件,不知道能不能帮上你。