I haven’t seen this issue covered on SO so here it goes. I have a seekbar that prevents seeking beyond the secondary progress(in this case, music buffering). Let’s say the song is 5 minutes long, 4 minutes have been buffered, and it is playing at the one minute mark. When I go to drag the thumb, it drags and drops fine. The issue is that when I stop dragging(without releasing) and then drag again, the thumb is rapidly jumping from the currently playing position(1 minute) to the position I am dragging the thumb. When I release, it’s fine, it’s only an issue with dragging the thumb. Here is my seekbar listener….
private SeekBar.OnSeekBarChangeListener seekBarChangeListener = new SeekBar.OnSeekBarChangeListener() {
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) {
int secondaryPosition = seekBar.getSecondaryProgress();
if (progress > secondaryPosition) {
seekBar.setProgress(secondaryPosition-1);
}
}
public void onStartTrackingTouch(SeekBar seekBar) {
}
public void onStopTrackingTouch(SeekBar seekBar) {
seekMediaPlayerToSeekBarTouch(seekBar);
}
};
I’m guessing you have a
Handleror aThreadto update theSeekBar? I would recommend setting up a basic check to see if the user is handling theSeekBarso it won’t keep trying to redraw the thumb for theSeekBarwhile it’s being handled. Just set a boolean, such asmSeekbarTrackingto true in theonStartTrackingTouch()method, then in theSeekBarupdater, make it check thatmSeekbarTrackingis false before it tries to update it.I don’t know if that will solve all of your problems though. Maybe you could try that and see how it affects your issue. It will probably help us help you if you post the code that you’re using to update the
SeekBar.Cheers