Code example for SeekBar

Methods: getId

0
   
   
 
  public void onProgressChanged(SeekBar seekBar, int progress, boolean fromTouch)
  { 
    if (seekBar.getId() == lPulseBar.getId())
    { 
      noise.setOffsetPulsePercent(progress / 2 + 25, 0);
      lPulseText.setText("Servo 1(L Wheel) = " + noise.getPulsePercent(0) + "% (" + noise.getPulseSamples(0) + " samples)");
    } 
    if (seekBar.getId() == lPulseBar2.getId())
    { 
      noise.setOffsetPulsePercent(progress / 2 + 25, 1);
      lPulseText2.setText("Servo 2(L Arm) = " + noise.getPulsePercent(1) + "% (" + noise.getPulseSamples(1) + " samples)");
    } 
    if (seekBar.getId() == rPulseBar.getId())
    { 
      noise.setOffsetPulsePercent(progress / 2 + 25, 2);
      rPulseText.setText("Servo 3(R Wheel) = " + noise.getPulsePercent(2) + "% (" + noise.getPulseSamples(2) + " samples)");
    } 
    if (seekBar.getId() == rPulseBar2.getId())
    { 
      noise.setOffsetPulsePercent(progress / 2 + 25, 3);
      rPulseText2.setText("Servo 4(R Arm) = " + noise.getPulsePercent(3) + "% (" + noise.getPulseSamples(3) + " samples)");
    } 
    if (seekBar.getId() == lrOffset.getId())
    { 
      mover.setOffset( ( progress / 2 + 25 ) - 50);
      lrOffsetText.setText("Left vs Right Offset = " + mover.getOffset());
    } 
  }