Android loading runtime environment with welcome interface

Source: Internet
Author: User

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

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.