N
N
Nikita2017-10-11 20:46:56
Java
Nikita, 2017-10-11 20:46:56

How to run method only once in onClick?

There is a button. It is necessary that from the first press of it the timer starts and does not start again when the next press of this button.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan0206, 2017-10-12
@NeToster

Create a boolean flag and change its value when the button is clicked. Flag value write in SharedPreferences

A
aol-nnov, 2017-10-11
@aol-nnov

I don't mind

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question