Java_Thread类的sleep()与SystemClock类的sleep()的区别

来源:互联网 发布:union软件 百度云 编辑:程序博客网 时间:2024/06/05 01:20
  • Thread.sleep()是java提供的函数。在调用该函数的过程中可能会发生InterruptedException异常。
  • SystemClock.sleep()是android提供的函数。在调用该函数的过程中不会发生InterruptedException异常,中断事件将要被延迟直到下一个中断事件。Use this function for delays if you do not useThread.interrupt(), as it will preserve the interrupted state of the thread.
原创粉丝点击