Android 多线程延迟(sleep)

来源:互联网 发布:李天生vb.net视频教程 编辑:程序博客网 时间:2024/05/18 00:51
new Thread(new Runnable(){             @Override              public void run(){                     int count = 0;                  while (true)                  {                              count++;                              Log.e("Demo","count="+count);                      try {                  Thread.sleep(500);                  } catch (InterruptedException e) {                  e.printStackTrace();                  }                  }              }             }).start();  

总结要点:
1、安卓内延迟只能用多线程实现
2、sleep外必须用try包裹

原创粉丝点击