For HardKey, when pressed in duplicate, should I use a timer to give time?

Asked 1 years ago, Updated 1 years ago, 74 views

HardKeyKeyCode: Assume that you have VoulmeUp, and if you press this VoulmeUp, a popup will float.

When you press the same Voulme Up Hard Key within seconds of pressing Voulme Up, To prevent events from being recalled Should I use the timer? How should I use the Timer? You want to prevent the key from processing duplicate events in approximately 5 seconds.

hardkey android timer

2022-09-22 18:33

1 Answers

Only if true (may be false depending on the variable name), leave one flag variable to run the button handler (initial value true)

It should be this logic, and if there is an additional logic to initialize the duplication prevention delay every time you press it, the process of re-registering the schedule after cancel() will be added.


2022-09-22 18:33

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.