首先實例化一個 Handler,然后在要跳轉的地方使用postDelayed這個方法,要實現的內容放 run()方法里面
1 private Handler handler = new Handler(); 2 3 4 handler.postDelayed(new Runnable() { 5 @Override 6 public void run() { 7 Intent intent = new Intent(getApplicationContext(),MainActivity.class); 8 this.startActivity(intent); 9 } 10 }, 3000); 11 12 }