title: Background music for game app that will play to all class
body: <p>i created a android app game that has a welcome screen named MainActivity.class  and will intent in Maimenu.class after 5 sec of sleep. the MainMenu class has start game,settings,about, and high score function. but my problem is i dont know how to make my background music play in all my activities/class it only plays in my welcome screen. i want that the background music will play continously in all my activity/class. 2nd problem is ihave a button ON and OFF in my settings class. how can i turn OFF my background music if i click the button off in my Settings.class. hope you can help me :) i appreciate your time answering my problem.god bless. btw newbie here</p>
  
  <pre><code>public class MainActivity extends Activity  {
  
  MediaPlayer backgroundmusic;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      MediaPlayer backgroundmusic = MediaPlayer.create(MainActivity.this, R.raw.bsound);
      backgroundmusic.start();
      Thread timer = new Thread(){
  
          public  void run(){
              try {
              sleep(5000);
  
              }catch(InterruptedException e){
                  e.printStackTrace();
              }finally{
                  Intent intent = new Intent(getApplicationContext(),MainMenu.class);
                  startActivity(intent);
              }
          }
      };
      timer.start();
  }
  </code></pre>