Tuesday, 10 September 2013

Play file mp3 in asset with file's name is number

Play file mp3 in asset with file's name is number

I have a file 100.mp3 in asset when add this file to asset,it display
error: invalid file name..I think cause is file's name is number But I
want to use this name to play as code follow. How must I do?
AssetFileDescriptor des = mContext.getAssets().openFd("100.mp3");
mp.setDataSource(des.getFileDescriptor(),
des.getStartOffset(),
des.getLength());
mp.prepare();
mp.start();

No comments:

Post a Comment