[android] MediaPlayer, SeekBar

출처 : http://dmh11.tistory.com/172

 

_player = new MediaPlayer();
_seekbar = (SeekBar) view.findViewById(R.id.progress_play);

.
.
setDataSource
prepare
start
.
.

ScheduledExecutorService service = Executors.newScheduledThreadPool(1);
service.scheduleWithFixedDelay(new Runnable()
{
   @Override
   public void run()
   {
      _seekbar.setProgress(_player.getCurrentPosition());
   }
}, 1, 1, TimeUnit.MICROSECONDS);