so I'm developing an android game. My main activity or the intro activity has the background music of the game. Overall it is the main background music of the entire game. So I let the music keep on playing:
private void startBgSound() {
// TODO Auto-generated method stub
//int soundFile = R.raw.backgroundmusic;
//AssetFileDescriptor afd = getResources().openRawResourceFd(soundFile);
bgsound = new MediaPlayer();
bgsound.reset();
bgsound = MediaPlayer.create(this, R.raw.backgroundmusic);
bgsound.setLooping(true);
bgsound.setVolume(100, 100);
bgsound.start();
}
by setting the loop to true. When the user should click the play button (still on the main activity) the next activity sits on top of the main activity. But in my second activity, I have put there a pause button, so when the user clicks on that, the background music should also pause as well.
Do you have any clever ideas on how to do that? I'm stuck with this issue. So I'd really appreciate if you could help. Thanks.