//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 }
之后,上机实践...
>>好没含金量的一篇文章喔,能够有实用价值就好
本文介绍了如何在Android应用中利用AssetFileDescriptor读取raw文件夹下的数据,通过示例代码展示了从raw资源加载音频到MediaPlayer的过程,并强调了实战中的实用性。


5279

被折叠的 条评论
为什么被折叠?



