Android Note--to determine if the program was first launched

Source: Internet
Author: User

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

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.