public class SplashActivity extends Activity{
Context context;
Timer splashTimer;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.splash_screen);
context= this;
splashTimer = new Timer();
splashTimer.schedule(new TimerTask() {
@Override
public void run() {
updateValue();
}
}, 1000, 15000);// 1 second for initial start value and 15 seconds to display splash screen
}
public void updateValue()
{
Intent intent = new Intent(context, .class);
startActivity(intent);
splashTimer.cancel();
finish();
}
}
from http://www.itcuties.com/android/how-to-create-android-splash-screen/
本文介绍了一个简单的Android启动屏幕(Splash Screen)实现方案。通过使用Timer和Intent,可以在指定时间后从启动界面跳转到应用的主活动。此方法适用于希望快速实现启动屏效果的开发者。
1万+

被折叠的 条评论
为什么被折叠?



