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                 }

 

posted @ 2015-04-13 14:50  小菜希  阅读(5324)  评论(0编辑  收藏  举报