Answer the question
In order to leave comments, you need to log in
How to disable clicking on a button for 20 minutes after pressing it?
How to disable clicking on a button for 20 minutes after pressing it with a countdown timer?
By setting the value of the button:
After exiting the application and re-entering the button, the button becomes available again!
post_data.setEnabled(false);
post_data.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
postRequest();
post_data.setEnabled(false);
}
});
Answer the question
In order to leave comments, you need to log in
In the button click handler, set the disable state to it and start a timer that will remove this state after the time has elapsed.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question