Android延迟

来源:互联网 发布:win7玩游戏掉帧 优化 编辑:程序博客网 时间:2024/06/09 20:04


http://blog.csdn.net/flying_tao/article/details/6756127

http://blog.csdn.net/gebitan505/article/details/18149981


1.利用定时器

TimerTask task = new TimerTask(){       public void run(){       //execute the task     }   };   Timer timer = new Timer(); timer.schedule(task, delay); 

2.利用Handler

 new Handler().postDelayed(new Runnable(){       public void run() {       //execute the task       }    }, delay);   

其中,delay表示延迟的时间,单位:毫秒。


0 0