使用AssetFileDescriptor 来读取(android)app的raw文件夹下的数据
//mp是MediaPlayer实例对象,fd是读取raw文件夹下的文件信息类try {AssetFileDescriptor fd = getResources().openRawResouceFd(R.raw.greet_1);mp.setDataSource(fd.getFileDescriptor(), fd.getStartOffset(), fd.getLength());
·
//mp是MediaPlayer实例对象,fd是读取raw文件夹下的文件信息类try { AssetFileDescriptor fd = getResources().openRawResouceFd(R.raw.greet_1); mp.setDataSource(fd.getFileDescriptor(), fd.getStartOffset(), fd.getLength()); mp.start(); fd.close(); } catch (IllegalArgumentException e) { // handle exception } catch (IllegalStateException e) { // handle exception } catch (IOException e) { // handle exception }
之后,上机实践...
>>好没含金量的一篇文章喔,能够有实用价值就好
更多推荐



所有评论(0)