I have a seekbar and trying to set the value from 60 to 180 for one and 40 to 190 for the second one in step of 1.
sb1 = (SeekBar) findViewById(R.id.progress
The easiest way to set a min and max value to a seekbar for me: if you want values min=60 to max=180, this is equal to min=0 max=120. So in your seekbar xml set property:
android:max="120"
min will be always 0.
Now you only need to do what your are doing, add the amount to get your translated value in any change, in this case +60.
seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
int translatedProgress = progress + 60;
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
Be careful with the seekbar property android:progress, if you change the range you must recalculate your initial progress. If you want 50%, max/2, in my example 120/2 = 60;