安卓欢迎界面实现,定时跳转页面
程序员文章站
2022-05-04 19:54:42
...
public class WelcomeActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_welcome);
Timer timer=new Timer();
TimerTask timerTask=new TimerTask() {
@Override
public void run() {
startActivity(new Intent(WelcomeActivity.this, MainActivity.class));
finish();
}
};timer.schedule(timerTask,2000);
}
}