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