I\'d like to set max and minimum limits of SeekBar to 50 and 20 respectively.
SeekBar has a direct option top provide max value, but how to set its
For example;
public static int LENGTH_MIN_VALUE = 20;
public static int LENGTH_MAX_VALUE = 50;
SeekBar seekBar = (SeekBar) findViewById(R.id.passwordSeekBar);
seekBar.setMax(LENGTH_MAX_VALUE);
seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if(progress <= Constract.PASSWORD_LENGTH_MIN_VALUE){
progress = Constract.PASSWORD_LENGTH_MIN_VALUE + progress;
}
String numberAsString = String.valueOf(progress);
seekNumberView.setText(numberAsString);
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {}
});