I am adding a comment to this topic because it happened to me and it took me several hours to understand what the problem was. The error is still active, and the setProgress () method sometimes does not work as expected.
I have MainActivity that capture and replace Fragments and pass the value of the SeekBar inside the packet of each fragment. The user changes the value of Seekbar, and his progress is placed in the Bundle . Then, when the user switch Fragment , the new one receives the SeekBar progress.
It works great to pass it that way, and I always have the correct value for my progress variable in the second snippet . The problem occurs when I use the setProgress (theProgressValueTransmitted) method. This sets my SeekBar progress only the first time that I replace the first fragment. After that, he never changes it, because the significance of progress is still correct.
I used:
int seekBarProgress; Bundle bundle = this.getArguments(); if (bundle != null) { seekBarProgress = bundle.getInt("seekBarProgress"); mySeekBar.post(new Runnable() { @Override public void run() { eventListTimeSeekBar.setProgress(seekBarProgress); } }); }
And this is the only way to do this job. Hope this helps someone with the same issue. This message is more than 4 years old, I donβt even understand how this error still exists, since it was reported.
source share