Reputation: 22493
i want to create seek bar in my project, for every step i want increment like this seek bar maxvalue = 6;
seek bar value increments : 0 1 2 3 4 5 6
i want seek bar values like this : 0 2 5 10 15 20 25
how can i achieve this.
Upvotes: 0
Views: 2783
Reputation: 25755
I would store the possible values in an array and use the current seek-bar value as the element-index for accessing the "desired" value.
Pseudo-code
int[] values = {0,2,5,10,15,20,25};
int current = values[ seekbar.getValue() ];
So for seekbar.getValue() == 2
your current == 5
.
Upvotes: 4
Reputation: 6037
Try something like this,
if((seekbar.getValue()%5)==0){
int n=seekbar.getValue()/5;
int seekValue=(n*5);
}
Upvotes: 1