Seekbar Doesnt move while playing
<p>I have recorded audio, and play it through the mediaplayer. Recording, playing works fine. I used a seekbar, while playing the recorded voice. I used the following coding to play the content stored in sdcard. It works fine.. mFileName is the audio file in sdcard.
The seek bar doesnt move, while playing. Any suggestions... </p>

<pre><code>      private void startPlaying()
{

 MediaPlayer mPlayer = new MediaPlayer();

    try {
        mPlayer.setDataSource(mFileName);
        mPlayer.prepare();
         mPlayer.start();
        mSeekBar.setMax(mPlayer.getDuration());
    } catch (IOException e) {
        Log.e(LOG_TAG, "prepare() failed");
    }
}
</code></pre>

<p>And I used</p>

<pre><code>    mSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            // TODO Auto-generated method stub
            if(fromUser){
                mPlayer.seekTo(progress);
                mSeekBar.setProgress(progress);
            }
        }
    });
    Thread currentThread  = new Thread((Runnable) this);
    currentThread.start();

 public void run() {
    // TODO Auto-generated method stub
    try {
        while(mPlayer != null){
            int currentPosition = mPlayer.getCurrentPosition();
            Message msg = new Message();
            msg.what = currentPosition;
            threadHandler.sendMessage(msg);
        }
        Thread.sleep(100);
    } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
private Handler threadHandler = new Handler(){
    public void handleMessage(Message msg){

        mSeekBar.setProgress(msg.what);
    }
};
</code></pre>

<p>The progressbar moves only when the user moves. It doent move atomatically.</p>
