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