1

I have implemented a range seek bar for my Android app using this library(https://github.com/Jay-Goo/RangeSeekBar). Currently it is working without any problem, but I need to setout value of the seekbar to be rouned to 5(Eg. When user moving the value it should be 5,10,15,20). As per my knowledge library does not offer any assistance on this.

After some research I have added following code to the setOnRangeChangedListener, but it does not seems to be working for me.

Can you please check and let me know how can I achieve this? Really appreciate the help in advance

 nmalrange.setOnRangeChangedListener(new OnRangeChangedListener() {
    
                @Override
   public void onRangeChanged(RangeSeekBar view, float leftValue, float rightValue, boolean isFromUser) {
    
              
                  int increasedvalue=5;
          if (urrange.getLeftSeekBar().getProgress() > nmrange.getLeftSeekBar().getProgress()) {
                   float urgentRight = urrange.getRightSeekBar().getProgress();
                   float nmalLeft = nmrange.getLeftSeekBar().getProgress();
    
                    float new_nmalLeft=((int)Math.round(nmalLeft/increasedvalue ))*increasedvalue;
                    float new_urgentRight=((int)Math.round(urgentRight/increasedvalue ))*increasedvalue;
                    urgentrange.setProgress(new_nmalLeft, new_urgentRight);
                    }

     @Override
            public void onStartTrackingTouch(RangeSeekBar view, boolean isLeft) {
                //start tracking touch
             
                }
  @Override
            public void onStopTrackingTouch(RangeSeekBar view, boolean isLeft) {
                //stop tracking touch

            }
              
    
}
Joe26
  • 79
  • 2
  • 9

0 Answers0