title: How to pause background music if some activity have video to play in android?
body: <p>There's some way to pause background music if on another activity have a video to play?</p>
  
  <p>I've using this code to play music in all activity:</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mediaPlayer = MediaPlayer.create(getApplicationContext(), R.raw.ultahcover);
    mediaPlayer.start();
  
    memories.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
          mediaPlayer.pause();
          length=mediaPlayer.getCurrentPosition();
          startActivity(new Intent(MainActivity.this, kenangan_kita.class));
        }
        // here's an activity with video player
      });
  
  @Override
    protected void onPause() {
      super.onPause();
      mediaPlayer.isPlaying(); //this is work to play on all activity but clashes with video music
    }
  </code></pre>
  
  <p>any idea to avoid clashes music player?</p>
  
  <p>please help me</p>