Anybody give me an idea as to what is going on - I have used this same
code in another app and it works fine.
It seems like it can't find the enter_dvd.mp3 file in the raw folder
but it is there. The error occurs at the create line.

public class playScales extends Activity implements
OnCompletionListener{

//Other methods, 1 of which calls playNote();

public void playNote(Context ctx)
        {

        /*************************************************************
         * mediaplayer solution
         *
         ************************************************************/


        System.out.println("mp-reset");
    mp = new MediaPlayer();
    mp = MediaPlayer.create(playScales.this, R.raw.enter_dvd);

/*Crashes program!!! -
Errors:

10-15 01:32:57.284: WARN/dalvikvm(4630): threadid=3: thread exiting
with uncaught exception (group=0x4000fe70)
10-15 01:32:57.307: ERROR/AndroidRuntime(4630): Uncaught handler:
thread main exiting due to uncaught exception
10-15 01:32:57.374: ERROR/AndroidRuntime(4630):
java.lang.NullPointerException
*/


        System.out.println("mp-set");
    mp.setOnCompletionListener(playScales.this);

        try {
                mp.prepare();
        } catch (IllegalStateException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
        } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
        }
        mp.seekTo(0);
        mp.start();

        }
}

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to