D
D
Dmitry2021-03-07 13:01:16
Java
Dmitry, 2021-03-07 13:01:16

How to count the number of clicks on a button in a certain time?

There is a time counter, expressed in terms of int seconds - it increases by +1 every second, and a button press counter int count_press, which increases when the button is pressed.

Question - how to determine how many times, for example, in 30 seconds, the user clicked on the button?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rPman, 2021-03-07
@rPman

The average?
Divide the total number of clicks during this time by (divide the elapsed time in seconds by 30 seconds) older than 30 seconds (they will be at the beginning of the array, if new ones are added to the end) - then the number of entries in the array will be the desired number of clicks in the last 30 seconds.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question