title: How to start MediaPlayer after it has been stopped in android
body: <p>I am new to Android and in my app I am working with <code>MediaPlayer</code>.</p>
  
  <p>When I first tap the start button, the song plays, but when I tap the stop button and then I tap on the start button again, the song does not start playing again. Here's what I have so far:</p>
  
  <pre><code>public class PlayngUrlFiles extends AppCompatActivity {
  
      Button start, pause, stop;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.playingurls_layout);
  
          start = (Button) findViewById(R.id.button1);
          pause = (Button) findViewById(R.id.button2);
          stop = (Button) findViewById(R.id.button3);
  
          final MediaPlayer mp = new MediaPlayer();
  
          try {
              mp.setDataSource("http://programmerguru.com/android-tutorial/wp-content/uploads/2013/04/hosannatelugu.mp3");
              mp.prepare();
          } catch (Exception e) {
              e.printStackTrace();
          }
  
          start.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  mp.start();
              }
          });
          pause.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  mp.pause();
              }
          });
          stop.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  mp.stop();
              }
          });
      }
  }
  </code></pre>