public class Form1 extends ActionBarActivity { private MediaPlayer mp; Context context; ... setContentView(R.layout.activity_form1); if (mp==null) { context = this; mp = MediaPlayer.create(context, R.drawable.mainmenus); mp.setLooping(true); mp.start(); }; .... public void startbook(View view) { mp.pause(); mp.stop(); mp.reset(); mp.release(); mp = null; Intent intent = new Intent(Form1.this, Form2.class); startActivity(intent); } When you press the startbook button, the sound does not stop. And if the launch of the sound hang on something like:
public void startmuz(View view) { mp = MediaPlayer.create(context, R.drawable.mainmenus); mp.setLooping(true); mp.start(); } The sound starts and stops normally. But! It is necessary that the sound starts playing when the activity is opened automatically. That with the above code does not work well, no way.