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                 }

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM