1

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 Xperia 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.

Curtain
  • 1,972
  • 3
  • 30
  • 51

1 Answers1

1

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

Community
  • 1
  • 1
Stefan H Singer
  • 5,469
  • 2
  • 25
  • 26
  • The issue is a little bit different. I cannot even call `mp.start()` on the `MediaPlayer` object and when I do, it gives me a NPE. – Curtain Jun 30 '11 at 15:15
  • Gah! Stupid me! My own recorded wav file was in the wrong format. Thanks for contributing! – Curtain Jun 30 '11 at 15:37