title: How to pause a music player programmatically
body: <p>I have used <code>MUSIC_PLAYER</code> in my application by starting like this:</p>
  
  <pre><code>Intent myint = new Intent("android.intent.action.MUSIC_PLAYER");
  startActivity(myint);
  </code></pre>
  
  <p>And I want to pause this player. How do I do that?</p>
  
  <pre><code>import android.media.AudioManager;
  
  import android.media.MediaPlayer;
  
  import android.os.Bundle;
  
  import android.app.Activity;
  
  import android.content.Intent;
  
  import android.view.Menu;
  
  public class MainActivity extends Activity {
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          Thread mtr = new Thread(){
              public void run()
              {
                  try {
                      Intent myint = new Intent("android.intent.action.MUSIC_PLAYER");
                      startActivity(myint);
                      sleep(50000);
                      // Here I want to pause my application after those 50 seconds.
                  }
                  catch(InterruptedException e){
                      e.printStackTrace();
                  }
                  finally{
                      Intent myint = new Intent("nextscreen");
                      startActivity(myint);
                  }
              }
          };
          mtr.start();
      }
  }
  </code></pre>