开发者

Audio Player in J2ME

I am new to J2ME. I want to play an audio song in my application. I have written

       Player p = null;

    try {           
        p = Manager.createPlayer(ge开发者_Python百科tClass().getResourceAsStream("aa.wav"),"audio/x-wav");
        p.start();

    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (MediaException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

where "aa.wav" is a wav format song placed in resource folder. when i debug this code

getClass().getResourceAsStream("aa.wav")

it returns null.

Can you please Help me thanks


if resource folder is under src then.

make it

getClass().getResourceAsStream("/resource/aa.wav")
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜