Several Application of Splash

Source: Internet
Author: User

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

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.