Android: SeekBar onProgressChanged-event doesn't get fired when setting progress programmatically
Stumbled across the same problem just now.
In my case, the onProgressChanged
did not get fired simply because the value did not actually change. I was setting the same value as the current one (0
:)
(and I don't see anything wrong with your code)
+1 for Romuald Brunet's answer:
Here was my "hack" to fix it:
<SeekBar android:id="@+id/seekbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:progress="1"
android:max="200" />
Note the progress="1", set the default progress in the layout to 1, then in my code when I actually default it to 0, a change in the progress occurs and the onProgressChanged() event fires.
My listener didn't fire because I was calling setProgress()
BEFORE setting the listener