Android timer realizes picture transformation

Android timer realizes picture transformation

In Android, to update the UI every second, you need to use the combination of timer, handler and message. If you don't use handler, you can't update the UI. My understanding is that there is a queue problem in handler, which can ensure that there is no blocking.

The code is as follows:

There are two points to note in this Code:

First: after updating the picture, you need to refresh the whole layout, LinearLayout. Invalidate();

Second: after using up the timer, destroy the timer while the activity is killed.

The above is the application of Android timer. If you have any questions, please leave a message or go to the community of this site for communication and discussion. Thank you for reading. I hope it can help you. Thank you for your support to this site!

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
分享
二维码
< <上一篇
下一篇>>