Package youbanwang. co. cc;
Import android. app. Activity;
Import android. content. Intent;
Import android. OS. Bundle;
Import android. OS. Handler;
Import android. view. animation. Animation;
Import android. view. animation. AnimationUtils;
Public class Splash extends Activity {
@ Override
Protected void onCreate (Bundle savedInstanceState)
{
// TODO Auto-generated method stub
Super. onCreate (savedInstanceState );
SetContentView (R. layout. splash );
New Handler (). postDelayed (new Runnable ()
{
@ Override
Public void run ()
{
// TODO Auto-generated method stub
Intent it = new Intent (Splash. this, Youban1Activity. class );
StartActivity (it );
Finish ();
}
},2000 );
}
}
------------------ Automatically display image SPLASH
Package tangshi. co. cc;
Import android. app. Activity;
Import android. content. Intent;
Import android. OS. Bundle;
Import android. OS. Handler;
Import android. OS. Message;
Import android. widget. ImageView;
Public class Splash extends Activity {
Private ImageView mImageView;
Private Handler mHandler;
Private final int SPLASH1 = 0;
Private final int SPLASH2 = 1;
Private final int SPLASH3 = 2;
Private final int TURNTOLOGIN = 3;
@ Override
Protected void onCreate (Bundle savedInstanceState ){
// TODO Auto-generated method stub
Super. onCreate (savedInstanceState );
SetContentView (R. layout. splash );
MImageView = (ImageView) findViewById (R. id. imageView1 );
MImageView. setImageResource (R. drawable. icon1 );
MHandler = new Handler (){
@ Override
Public void handleMessage (Message msg ){
// TODO Auto-generated method stub
Super. handleMessage (msg );
Switch (msg. what ){
Case SPLASH1:
MImageView. setImageResource (R. drawable. icon1 );
Break;
Case SPLASH2:
MImageView. setImageResource (R. drawable. icon2 );
Break;
Case SPLASH3:
MImageView. setImageResource (R. drawable. icon3 );
Break;
Case TURNTOLOGIN:
MImageView. setImageResource (R. drawable. icon4 );
Break;
Default:
Break;
}
};
};
New Thread (){
Public void run (){
Try {
Sleep (1000 );
MHandler. sendEmptyMessageDelayed (SPLASH1, 0 );
Sleep (1000 );
MHandler. sendEmptyMessageDelayed (SPLASH2, 0 );
Thread. sleep (1000 );
MHandler. sendEmptyMessageDelayed (SPLASH3, 0 );
Sleep (2000 );
MHandler. sendEmptyMessageDelayed (TURNTOLOGIN, 0 );
} Catch (Exception e ){
// TODO: handle exception
} Finally {
Intent intent = new Intent (Splash. this,
HahamxActivity. class );
StartActivity (intent );
Finish ();
}
};
}. Start ();
}
}
--------- Splash animation
Package gongzibai. co. cc;
Import android. app. Activity;
Import android. content. Intent;
Import android. OS. Bundle;
Import android. OS. Handler;
Import android. view. animation. Animation;
Import android. view. animation. AnimationUtils;
Import android. widget. ImageView;
Import android. widget. TextView;
Public class Splash extends Activity {
Private ImageView mImageView;
Private TextView mTextView;
Animation animation;
@ Override
Protected void onCreate (Bundle savedInstanceState ){
// TODO Auto-generated method stub
Super. onCreate (savedInstanceState );
SetContentView (R. layout. splash1 );
MImageView = (ImageView) findViewById (R. id. imageView1 );
MTextView = (TextView) findViewById (R. id. textView1 );
Animation mAnimation = AnimationUtils. loadAnimation (this,
R. anim. scaleanimation );
MImageView. startAnimation (mAnimation );
MTextView. startAnimation (mAnimation );
New Handler (). postDelayed (new Runnable (){
@ Override
Public void run (){
// TODO Auto-generated method stub
Intent it = new Intent (Splash. this, RandomActivity. class );
StartActivity (it );
Finish ();
}
},2000 );
}
}
--------- Anim
<? Xml version = "1.0" encoding = "UTF-8"?>
<Set android: Using interpolator = "false" xmlns: android = "http://schemas.android.com/apk/res/android">
<Alpha
Android: fromalphi = "0.0"
Android: toAlpha = "1.0"
Android: duration= "3000"
> </Alpha>
</Set>
From the column of gongzibai