Reputation: 906
If I set the progress or the max value of a seekbar from code then the onProgressChanged event gets fired. How to prevent this? I want the event to fire only when the user modifies the progress value from the UI by dragging the thumb of the seekbar.
Upvotes: 3
Views: 977
Reputation: 768
When Every time you are setting the value from code every time onProgressChanged event fired. you can prevent it by giving the max value to seek bar into xml. and use a flag variable and put the code into that flag variable. e.g.
boolean flag = false;
onProgressChanged() {
if(flag) {
---if you set the max bu code it skip the if body-------
-------- do you code-----------------
}
flag = true;
}
Upvotes: 0