美文网首页Android
Thread.sleep() & SystemClock

Thread.sleep() & SystemClock

作者: Ten_Minutes | 来源:发表于2016-07-24 16:04 被阅读245次

Thread.sleep()是java提供的函数。在调用该函数的过程中可能会发生InterruptedException异常。

SystemClock.sleep()是android提供的函数。在调用该函数的过程中不会发生InterruptedException异常,中断事件将要被延迟直到下一个中断事件。

SystemClock.sleep(millis) is a utility function very similar to Thread.sleep(millis), but it ignores InterruptedException. Use this function for delays if you do not use Thread.interrupt(), as it will preserve the interrupted state of the thread.

相关文章

网友评论

    本文标题:Thread.sleep() & SystemClock

    本文链接:https://www.haomeiwen.com/subject/aqxgjttx.html