C
C
Chesterfield252020-10-11 18:40:43
Java
Chesterfield25, 2020-10-11 18:40:43

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

1 answer(s)
S
Sergey Gornostaev, 2020-10-11
@sergey-gornostaev

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 question

Ask a Question

731 491 924 answers to any question