//一、写一个定时器 5秒后开启
final Intent localIntent=new Intent(FirstActivity.this,SecondActivity.class);
Timer timer=new Timer();
TimerTask task=new TimerTask(){
@Override
public void run(){
startActivity(localIntent);
}
};
timer.schedule(task,10000);
//二、写一个线程 5秒后跳转,postDelayed(Runnable r, long delayMillis)
new Handler().postDelayed(new Runnable() {
public void run() {
final Intent mainIntent = new Intent(FirstActivity.this,SecondActivity.class);
FirstActivity.this.startActivity(mainIntent);
FirstActivity.this.finish();
overridePendingTransition(android.R.anim.fade_in,android.R.anim.fade_out);
}
}, 5000);