title: Android: How to stop media (mp3) in playing when specific milliseconds come?
body: <p>I have an mp3 file and I want to play a specific word in it. I have a start time (<code>6889 ms</code>) and end time (<code>7254 ms</code>).</p>
  
  <p>I have these codes:</p>
  
  <pre><code>package com.example.playword;
  
  import java.io.IOException;
  import android.app.Activity;
  import android.media.MediaPlayer;
  import android.os.Bundle;
  import android.widget.TextView;
  
  public class PlayWord extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
      final TextView tv = new TextView(this);
  
      tv.setText("Playing...");
      setContentView(tv);
  
      final MediaPlayer mPlayer = MediaPlayer.create(this, R.raw.nicholas);
  
      try {
        mPlayer.prepare();
      } catch (IllegalStateException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
  
      mPlayer.seekTo(6889); //this is the start time
      mPlayer.start();
      //how can I end it at 7254 ms?
    }
  }
  </code></pre>