Android等待3秒跳转

首先实例化一个 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                 }
原文地址:https://www.cnblogs.com/spadd/p/4422172.html