I'm getting mad trying to make my application play a sound !...
I'm developping under Eclipse, with SDK 1.5. I put my mp3 file into the raw folder.
And put this function in my main activity:
Using java Syntax Highlighting
- public void playMusic() {
- try {
- MediaPlayer mp = new MediaPlayer();
- mp.create(this, R.raw.mynotif);
- mp.start();
- Toast.makeText(this, "Launched ?",Toast.LENGTH_SHORT).show();
- mp.release();
- } catch (Exception e) {
- Toast.makeText(this, "Exception: " + e.getMessage(),Toast.LENGTH_SHORT).show();
- }
- }
Parsed in 0.032 seconds, using GeSHi 1.0.8.4
The activity only display a view, and launch the playMusic function.
The result is only a TOAST saying "Launched ?" : taht means there is no exception but ... I CANNOT HEAR ANYTHING !
I thought it was an emulator setting issue, but the application "Music" can play music and I can hear it...
Any idea ??
Tahnk you very much for your precious help !!!
Nek.


