开发者

how to pass the file path in android

Hi all i have java 开发者_如何学Goproject for calculating bpm now trying convert in to android project.While i get the following error. i have mh.mp3 file in res\raw folder. i need to pass the file name with path. i need specify file path in " player = new Player(new FileInputStream("res\raw\mh.mp3"), output);" i tried the following also but did not work

player = new Player(new FileInputStream("R.raw.mh"), output);"

it shows error at the following line as IndexOutOfBound Exception at

text.setText("bpm is "+processor.getBPM());

but in java it works well when send file name as command line argument.


R.raw.mh isn't the filename; it's a resource ID. You should use Resource.openRawResource().

Please don't spam the same question multiple times. You posted the same question as bpm calculation error in android 20 minutes ago.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜