title: Android Media Player Plays In The Background, But Doesn't Stop When App Killed
body: <p>I'm new to Android, so I have a problem. In Android I want to play background music as soon as my music player starts and have it continue even if the activity changes from one to another. I've tried this code:</p>
  
  <pre><code>MediaPlayer music = MediaPlayer.create(MainActivity.this, R.drawable.bgscore);
  music.start();
  </code></pre>
  
  <p>However, the sound should stop when user closes the app, and it doesn't. How can I achieve this? </p>