Android development-Implementation of the pop-up screen before the application starts

Source: Internet
Author: User

The pop-up screen is the splashscreen. It can also be called the startup screen, that is, when the screen is started, it will be flashed (displayed) and automatically closed after several seconds.

The implementation of Android is very simple. It can be implemented using the postdelayed method of the handler object. In this method, a runnable object and a delay time are passed. This method achieves a delayed execution effect. The delay time is specified by 2nd parameters, in milliseconds. The first parameter is the runnable object, which contains the operations to be performed after the delay.

The Code is as follows:

New handler (). postdelayed (New runnable (){

@ Override
Public void run (){
// Todo auto-generated method stub
Intent intent = new intent (actsplashscreen. This, actmain. Class );
Startactivity (intent );
Actsplashscreen. This. Finish ();
}
},2500 );

 

The code above shows that the page Jump operation is performed with a latency of 2500 milliseconds. The specific operation is in the implementation of the run method.

The specific steps are as follows:

1. Implement a pop-up form and Set background images.

2. Implement the main form. The form will be started after the screen flash ends.

2. Handle a delayed page Jump operation in the oncreate method overload in the pop-up form. The method is shown in the code above. Jump to the main form of the program here

 

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.