1 Public classWelcomeextendsActivity {2 Private Final LongSplash_length = 2000;3Handler Handler =NewHandler ();4 5 Public voidonCreate (Bundle savedinstancestate) {6 Super. OnCreate (savedinstancestate);7 Setcontentview (r.layout.farst_img);8 9 //define a setting record app that is launched several times!!! TenSharedpreferences setting = Getsharedpreferences ("Com.example.hr_jie", 0); OneBoolean User_first = Setting.getboolean ("First",true); A if(User_first) {//the first time jumps to the Welcome page -Setting.edit (). Putboolean ("First",false). commit (); - Tiaozhuanzhu (); the}Else{//If this is the second boot, jump directly to the main page . - Tiaozhuanfu (); - } - } + - Public voidTiaozhuanzhu () { +Handler.postdelayed (NewRunnable () {//use Handler's postdelayed to implement delay jumps A at Public voidrun () { -Intent Intent =NewIntent (Welcome. This, Welcome_four.class); - startactivity (Intent); - finish (); - } -}, Splash_length);//2 seconds to go to application main interface mainactivity in } - to Public voidTiaozhuanfu () { +Handler.postdelayed (NewRunnable () {//use Handler's postdelayed to implement delay jumps - the Public voidrun () { *Intent Intent =NewIntent (Welcome. This, Mainactivity.class); $ startactivity (Intent); Panax Notoginseng finish (); - } the}, Splash_length);//Jump to App Welcome screen in 2 seconds + } A}
Android Note--to determine if the program was first launched