Two common ways of countdown verification of Android SMS verification code
preface
This paper mainly introduces the function of SMS verification code. Here, two common methods are summarized, which can be used directly.
Look at the picture
Note: the time here starts from 10. It is modified so that the demonstration time does not wait too long.
The method is as follows
1. The first method: timer
Note: according to your own needs, you can modify the background color and display text in different states here. You can directly call new timercount (XXX, XXX, XXX). Start() under the button to listen.
2. The second method: handler
Note: in this way, the handler receives the message in real time to set the button status. For message sending, SendMessage or post can be used.
summary
The above is the whole content of this article. I hope the content of this article can bring some help to your study or work. If you have any questions, you can leave a message.