You're taking a curious approach to the MediaPlayer, but one thing that jumps out at me is this:
public static MediaPlayer create(Context context, int musicID) {
if (mediaPlayer != null) {
mediaPlayer.release();
}
mediaPlayer.create(context, musicID);
try {
mediaPlayer.prepare();
} catch (IOException e) {
e.printStackTrace();
}
return mediaPlayer.create(context, musicID);
}
You call mediaPlayer.create(), then .prepare(), then create(...) again?
Also, create is a static method, so it should be called as MediaPlayer.create and you should hold the reference to it. When you're calling prepare(), you're calling prepare() on a MediaPlayer object that hasn't been created.
Edit: If you want to keep this method, revise it accordingly:
public static MediaPlayer create(Context context, int musicID) {
if (mediaPlayer != null) {
mediaPlayer.release();
}
mediaPlayer = MediaPlayer.create(context, musicID);
try {
mediaPlayer.prepare();
} catch (IOException e) {
e.printStackTrace();
}
return mediaPlayer;
}