开发者

WAV file MediaPlayer

I'm trying to play a WAV file from the SD card. It works on some phones (Nexus S, Nexus One etc.) but not in Xperia Mini series.

Code:

// On some phones, this line works, but on X开发者_JAVA技巧peria Mini 
// series phones MediaPlayer.create()
// returns null from this line below.
MediaPlayer mp = MediaPlayer.create(this, Uri.fromFile(new File(filePath)));

The LogCat error message can be found here.

Any ideas? It certainly works on some phones, but other phones just reject the wav file.


Seems to be the same issue (and solution) as this one: Android - play sound on button click - Null pointer exception

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜