Android customized chrome realizes the countdown function of short message verification code stopwatch

This example shares the countdown function implemented by chrome, and Android provides an API for timing by seconds for your reference. The specific contents are as follows

1、 Custom chrometerview continues from textview

Main principle: first set a benchmark countdown time mbaseseconds. The built-in handler sends an empty message every 1s, mremainseconds --. At the same time, refresh the interface view and call back to the external caller. It is only zero. The external caller can control the working state of the timer through start() / pause() / stop(). You can take the scenario of sending SMS verification code in the app as an example. A very rough interface is made, but the functions are realized.

2、 No custom control properties are added in the XML, the same as textview

3、 Do a simple test in activity (take the actual application scenario where SMS verification code can be sent as an example)

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>