i have build a custom media player and i want to show the seekbar also.
The seekbar is showing for now but is not functional i.e. it is not progressing when the song is played. Let me know where am i wrong . Following is the code

```
public class myPlayer extends Activity implements Runnable,SeekBar.OnSeekBarChangeListener {

    MediaPlayer mPlayer;
    Button play,stop;
    SeekBar seekbar;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        seekbar = (SeekBar)findViewById(R.id.seekbar);
        mPlayer = MediaPlayer.create(this,R.raw.sajnave);
        play=(Button)findViewById(R.id.play);
        stop=(Button)findViewById(R.id.stop);
        Toast.makeText(myPlayer.this, ""+mPlayer.getDuration(), Toast.LENGTH_SHORT).show();

        play.setOnClickListener(new OnClickListener(){

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                mPlayer.start();

            }

        });

        stop.setOnClickListener(new OnClickListener(){

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                Toast.makeText(myPlayer.this, ""+mPlayer.getCurrentPosition(), Toast.LENGTH_SHORT).show();
                mPlayer.stop();
            }

        });
    }

    @Override
    public void run() {
        // TODO Auto-generated method stub

        int currentPosition = 0;

                int total = mPlayer.getDuration();

                seekbar.setMax(total);

                while (mPlayer != null && currentPosition < total) {

                    try {

                        Thread.sleep(1000);

                        currentPosition = mPlayer.getCurrentPosition();

                    } catch (InterruptedException e) {

                        return;

                    } catch (Exception e) {

                        return;

                    }

                    seekbar.setProgress(currentPosition);

                }

    }

    @Override
    public void onProgressChanged(SeekBar arg0, int arg1, boolean arg2) {
        // TODO Auto-generated method stub
        mPlayer.seekTo(arg1);
    }

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

    }

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

    }

}

```