I am using the stock SeekBar component to navigate through a set of ViewPagers and it’s working quite fine. Only problem is that when the data changes, I have to dynamically change the max value of the SeekBar via setMax(int value). When I do that, the SeekBar does not get updated until I navigate to a new page. I have a hacky fix in place where I do this, to force a onProgressChanged:
seekBarVP.setProgress(focusedPage+1);
seekBarVP.setProgress(focusedPage-1);
seekBarVP.setProgress(focusedPage);
Is there a better way to do this?
The Question is some months old now but I’ll answer anyway because searching for this problem brought me here.
Answer is there is actually a bug in Android. It seems to be fixed on my 3.2.1 tablet but the bug is present on my 2.3.6 phone. The bug is in the ProgressBar widget which is a parent of the SeekBar class. Your solution to setting the progress to a bogus value and back is so far the easies workaround I could find.
You will find more detailed information about this bug here:
android progressBar does not update progress view/drawable