I am developing a music application. SeekBar progress is changing perfectly according to the song, but when I drag the seekbar, song is not playing/dragging perfectly. For ex: when I drag the position of seek bar from 1:20 to 1:50, after dragging, a bit of song(1sec) at 1:20 is playing and then the song is continuing as usual from 1:50. And even while dragging seekbar, song is not dragging smoothly.I had installed 2-3 music apps from market,they play songs smoothly when seekbar is dragged.
Here is the code I had written in my Activity:
songSeekBar.setOnTouchListener(new OnTouchListener(){
@Override
public boolean onTouch(View v, MotionEvent event) {
SeekBar sb = (SeekBar)v;
myMediaPlayer.seekTo(sb.getProgress());
return false;
}
});
Is there any way to achieve smooth progress of song when seekbar is dragged.
Don’t use an
OnTouchListenerhere. Instead, use anOnSeekBarChangeListener, this will work much better.