In my application i have a button. After single and double clicking of the button will perform separate operation. How can i do that? Thanks
I also got the same problem once
setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if(isFmOn()){
//stopFM
}else{
//do other things
}
}
}
when I clicked the Button,FM stopped;but when I double clicked,FM did not stop.The problem was that single and double clicking of the button ,the value of isFmOn() was difference. I sloved the problem using this:
setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Thread.sleep(500);//500ms was enough to finish stopFM before the second click
if(isFmOn()){
//stopFM
}else{
//do other things
}
}
}