I am able to play a local mp3 if I use the static method MediaPlayer.create(context, id) but it\'s not working if I use the non-static method MediaPlayer.setDataSource(Strin
When dealing with a raw resource, you should rely on the following constructor:
public static MediaPlayer create (Context context, int resid)
Convenience method to create a MediaPlayer for a given resource id. On success, prepare() will already have been called and must not be called again.
The code looks like
mediaPlayer = MediaPlayer.create(this, R.raw.test0);
mediaPlayer.start();
Don't forget to call mediaPlayer.release() when you're done with it.
(source)