Thread using for seekbar on android mediaplayer
<p>How to create a thread that will check the song position every second and move the seekbar based on the song position. i used the blow code it's play only two songs..then it's turn away from  my applicatin</p>

<pre><code>public class setp implements MediaPlayer.OnPreparedListener  
         {

            public void onPrepared(MediaPlayer mps) {
                // TODO Auto-generated method stub
                seekbar.setMax(mp.getDuration());
                 new Thread(new Runnable() {

                  public void run() {
                          while(mp!=null &amp;&amp; mp.getCurrentPosition()&lt;mp.getDuration())
                          {
                              seekbar.setProgress(mp.getCurrentPosition());
                              Message msg=new Message();
                              int millis = mp.getCurrentPosition();

                              msg.obj=millis/1000;

                               try {
                                   Thread.sleep(100);
                               } 
                               catch (InterruptedException e) {
                                  e.printStackTrace();
                               }
                          }
                  }
          }).start();
            }
</code></pre>
