Hello everyone, This one has had me stumped for the last couple of days. I'm trying to create a MediaPlayer for a resource I have in res/raw, but I (!!!)DO NOT(!!!) want to create it by performing MediaPlayer.create(Context context, int resid), because I am experimenting with a few different things and I do not want to immediately start blocking by calling prepare.
If I use: MediaPlayer mp = new MediaPlayer(this, R.raw.foo); mp.start(); The sound plays correctly, so I know that the sound is not the issue. Additionally, Notification n = new Notification( . . . ); n.sound = "android.resource://my.package.name/" + R.raw.foo; myNManager.notify(0, n); will correctly play the sound, so I know the URI I'm using is correct (at least for that). However, if I try MediaPlayer mp = new MediaPlayer(); mp.setDataSource("android.resource://my.package.name/" + R.raw.foo); mp.prepare(); I will get a null pointer exception when prepare is called. What is going on here? What am I missing? Is it even possible to do what I want, and if not, why not? I've been looking at the bytecode for MediaPlayer, and the only place context is used is for getting the resource, so I know I don't have to worry about setting that. I can't peer into setDataSource because it is native. --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---