Welcome interface in Android program

Source: Internet
Author: User

Well, in the project, must first use the Welcome interface, the following is my project in the simplest of a welcome interface, that is, open the program, first display a picture, and then wait a while after the picture disappears, into the login screen. Directly on the code, there is no explanation for comments:

First, Welcom.java.

1ImportCN.NEDU.MATH.NINEBOX.R;2Importandroid.app.Activity;3ImportAndroid.content.Intent;4ImportAndroid.content.res.Configuration;5ImportAndroid.os.Bundle;6ImportAndroid.os.Handler;7ImportAndroid.os.Message;8ImportAndroid.view.Window;9ImportAndroid.view.WindowManager;1011PublicClass WelcomeExtendsActivity {12PrivateHandler Handler;1314@Override15PublicvoidOnCreate (Bundle savedinstancestate) {16Super. OnCreate (Savedinstancestate);17//Set Full Screen18This.requestwindowfeature (Window.feature_no_title);//Remove the title bar (the name of the application)GetWindow (). SetFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN,//Remove the status bar section (battery icons and all modifications)20WindowManager.LayoutParams.FLAG_FULLSCREEN);21st22//Start a line preempted Welcome screen23Setcontentview (R.layout.welcome);Handler =NewHandler () {25PublicvoidHandlemessage (Message msg) {26if (Msg.arg1 = = 1) {Intent Intent =NewIntent ();Intent.setclass (Welcome.This, Denglu.Class);29StartActivity (Intent);30Finish ();31}32}33};34NewThread () {35PublicvoidRun () {36//TODO auto-generated Method Stub37Try{Sleep (1500);//Thread paused for 1.5 seconds, per millisecondThe Message msg =Handler.obtainmessage ();MSG.ARG1 = 1;Handler.sendmessage (msg);//Send Message42}Catch(Interruptedexception e) {43//TODO auto-generated Catch block44E.printstacktrace ();45}46 }47}.start (); //48 } 49 // When the screen is displayed ( The method 50 public void onconfigurationchanged (Configuration newconfig) {51 52 super.onconfigurationchanged (Newconfig); 53 }54}     

Welcom.xml

<?xml version= "1.0" encoding= "Utf-8"? ><linearlayout xmlns:android= "http://schemas.android.com/apk/res/ Android "    android:layout_width=" fill_parent "    android:layout_height=" fill_parent "    android:background = "@drawable/huanyingtupian"    android:orientation= "vertical" ></LinearLayout>

Welcome interface in Android program

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.