title: How to stop playing sounds on button click to start another sound file?
body: <p>I have two buttons and two songs. If I click the first button, the first sound plays. But if I click the second button while the first sound is playing the second sound starts playing too.<br />
  How can I stop other sounds?</p>
  <p>My code:</p>
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      final MediaPlayer johnCenaPlayer = MediaPlayer.create(this, R.raw.john_cena);
      Button johnCenaButton = (Button) findViewById(R.id.john_cena_button);
      johnCenaButton.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              johnCenaPlayer.start();
          }
      });
  
      final MediaPlayer haGayPlayer = MediaPlayer.create(this, R.id.ha_gay_button);
      Button haGayButton = (Button) findViewById(R.id.ha_gay_button);
      haGayButton.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              haGayPlayer.start();
          }
      });
  }
  </code></pre>