I used to think that splash page is just a picture fun.
Today only to know that the environment should be loaded on this page ...
The forum and GitHub on too many imitation xxx projects really can only learn the idea of the UI ...
Before loading the environment into the application, no wonder it took so long to start white screen ...
The code is simple, do a thread, and then delay runs, as follows:
Public classSplashactvity extends Abstractactivity {Private StaticFinalintSleeptime =4000; @Overrideprotected voidonCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate); Setcontentview (R.layout.activity_splash); NewHandler (). postdelayed (NewRunnable () {@Override Public voidrun () {//Initializing the service LongStart =System.currenttimemillis (); Initservice (); LongCosttime = System.currenttimemillis ()-start; if(Sleeptime-costtime >0) { Try{thread.sleep (sleeptime-costtime); } Catch(interruptedexception e) {e.printstacktrace (); }} log.d ("Splah Act-------->","inited Service"); //interface JumpString token =appcontext.getinstance (). GetToken (); if(Textutils.isempty (token)) {startactivity (signinactivity.newintent ()); } Else{startactivity (mainactivity.newintent ()); } finish (); } }, -); } Private voidInitservice () {//Sign up for ring letter notificationappcontext.getinstance (). Initenvir (); //Register Baidu Locatorappcontext.getinstance (). Initlocation (); }}
Android loading runtime environment with welcome interface