android,有没有让服务延迟或睡眠的方法?

时间:2022-09-06 01:17:29

i need to let service sleep for 0.5 sec just as using Thread.sleep();

我需要让服务睡眠0.5秒,就像使用Thread.sleep();

is there any method??

有什么方法??

1 个解决方案

#1


18  

Yes there is. It's called SystemClock.sleep(millis). There's also Thread.sleep(millis). I suggest reading up on the differences.

就在这里。它叫做SystemClock.sleep(millis)。还有Thread.sleep(millis)。我建议阅读差异。

#1


18  

Yes there is. It's called SystemClock.sleep(millis). There's also Thread.sleep(millis). I suggest reading up on the differences.

就在这里。它叫做SystemClock.sleep(millis)。还有Thread.sleep(millis)。我建议阅读差异。