Android font flashing animation (thread)

Source: Internet
Author: User

Android font flashing animation, implemented using thread and Timer

Public class activitymain extends activity {<br/> Public void oncreate (bundle savedinstancestate) {<br/> super. oncreate (savedinstancestate); <br/> setcontentview (R. layout. main); <br/> spark (); <br/>}</P> <p> private int clo = 0; <br/> Public void spark () {<br/> final textview touchscreen = (textview) findviewbyid (R. id. textview01); // obtain the textview object of the page <br/> timer = new timer (); <br/> timertask taskcc = new timertask () {</P> <p> Public void run () {<br/> runonuithread (New runnable () {<br/> Public void run () {<br/> If (clo = 0) {<br/> clo = 1; <br/> touchscreen. settextcolor (color. transparent); // transparent <br/>} else {<br/> If (clo = 1) {<br/> clo = 2; <br/> touchscreen. settextcolor (color. red); <br/>}else {<br/> clo = 0; <br/> touchscreen. settextcolor (color. green); <br/>}< br/>}); <br/>}< br/> }; <br/> timer. schedule (taskcc, 1,300); // The parameters are delay (after which) and duration (Execution interval) <br/>}< br/>}



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.