Android loading Interface

Source: Internet
Author: User

Code:

Package COM. nanguabing. splashactivity; import android. annotation. suppresslint; import android. app. activity; import android. OS. bundle; import android. OS. handler; import android. OS. message; import android. widget. imageview; @ suppresslint ("handlerleak") public class splashactivity extends activity {imageview miv01, miv02, miv03, miv04, miv05; thread mthread; Boolean misend = false; // asynchronous processing of private handler mhand in sub-threads Ler = new handler () {public void handlemessage (Message MSG) {super. handlemessage (MSG); updateui (MSG. what) ;}}; private void updateui (INT what) {If (what = 0) {miv05.setbackgroundresource (R. drawable. initdot1); miv04.setbackgroundresource (R. drawable. initdot1); miv01.setbackgroundresource (R. drawable. initdot3);} else if (what = 1) {miv01.setbackgroundresource (R. drawable. initdot3);} else if (what = 2) {m Iv01.setbackgroundresource (R. drawable. initdot2); miv02.setbackgroundresource (R. drawable. initdot3);} else if (what = 3) {miv01.setbackgroundresource (R. drawable. initdot1); miv02.setbackgroundresource (R. drawable. initdot2); miv03.setbackgroundresource (R. drawable. initdot3);} else if (what = 4) {miv02.setbackgroundresource (R. drawable. initdot1); miv03.setbackgroundresource (R. drawable. initdot2); miv04.setbac Kgroundresource (R. drawable. initdot3);} else if (what = 5) {miv03.setbackgroundresource (R. drawable. initdot1); miv04.setbackgroundresource (R. drawable. initdot2); miv05.setbackgroundresource (R. drawable. initdot3);} else if (what = 6) {miv04.setbackgroundresource (R. drawable. initdot1); miv05.setbackgroundresource (R. drawable. initdot2) ;}}@ overrideprotected void oncreate (bundle savedinstancestate) {// todo Uto-generated method stubsuper. oncreate (savedinstancestate); Init ();} private void Init () {initui (); initdata ();} public void initui () {setcontentview (R. layout. activity_splash); miv01 = (imageview) findviewbyid (R. id. s_iv01); miv02 = (imageview) findviewbyid (R. id. s_iv02); miv03 = (imageview) findviewbyid (R. id. s_iv03); miv04 = (imageview) findviewbyid (R. id. s_iv04); miv05 = (imageview) findviewbyid (R. id. s_iv05 ); Mthread = new thread (New runnable () {@ overridepublic void run () {While (! Misend) {for (INT I = 0; I <6; I ++) {system. out. println ("1111111111111111111111111111111111111111"); try {thread. sleep (500);} catch (interruptedexception e) {// todo auto-generated catch blocke. printstacktrace ();} message m = new message (); M. what = I; mhandler. sendmessage (m) ;}}}); mthread. start ();} public void initdata () {// todo auto-generated method stub} @ overridepublic void onbackpressed () {misend = true; super. onbackpressed ();}}

Csdn: Download

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.