方法一:
new Handler(new Handler.Callback() { //处理接收到的消息的方法 @Override public boolean handleMessage(Message arg0) { //实现页面跳转 startActivity(new Intent(getApplicationContext(),MainActivity.class)); return false; } }).sendEmptyMessageDelayed(0, 3000); //表示延时三秒进行任务的执行
方法二:
private void enterHome(){ Timer time = new Timer(); TimerTask tk = new TimerTask() { Intent intent = new Intent(MainActivity.this,HomeActivity.class); @Override public void run() { // TODO Auto-generated method stub startActivity(intent); finish(); } };time.schedule(tk, 2000); }
时间: 2024-10-12 22:03:03