java - How to play mp3 file android w/ mediaplayer if files in same directory as activity class? -
java - How to play mp3 file android w/ mediaplayer if files in same directory as activity class? -
i've never liked how android implements fetching local resources 1 can't work around odd reason. mp3 files in same bundle mainactivity how can play them using media player? i've resorted stackoverflow because maintain seeing other posts , reply referring not exist in case "r.raw.*".. help appreciated.
mediaplayer player = new mediaplayer(); player.setdatasource(mainactivity.class.getresource("file.mp3").getpath()); player.prepare(); player.start();
when utilize code nil happens, believe it's because can't fetch sound file in other java implementation - android seems pedantic , tedious.
any help appreciated!
java android android-mediaplayer
Comments
Post a Comment