Android: Programmatically trigger SeekBar.onProgressChanged()

Recently I stumbled over a  small absurdity. I was implementing an automatic harmonic adapter to create sonant or absonant sound based on a primary frequency. In order to achieve this, I used a SeekBar for both, the multiplier and base frequency. The theory was: The multiplier onProgressChanged event will alter the overtones. So if the base frequency changes I have to trigger the multiplier event to adapt the new fundamental tone. I was using the following piece of code:
this.oscMultiplier.setOnSeekBarChangeListener( new SeekBar.OnSeekBarChangeListener() {
// osc update function
// ...
} );


if ( oscMultiplier.getProgress() > 0 ) {
oscMultiplier.setProgress( oscMultiplier.getProgress() );


But it did not work. The multiplier event was not being fired. While I was searching, I noticed that the event will only be triggered if the (progress-)value is really altered. So I have to reset the value before I can trigger the event:
int multiplier = oscMultiplier.getProgress();
if ( multiplier > 0 ) {
oscMultiplier.setProgress( 0 );
oscMultiplier.setProgress( multiplier );
{{ message }}

{{ 'Comments are closed.' | trans }}