简体   繁体   English

Android Handler 消息队列

[英]Android Handler Message Queue

I am calling我打电话

handler.postDelayed(runnable, time); handler.postDelayed(runnable, time); handler.post(runnable2); handler.post(runnable2);

Will the second runnable not get handled until the first message in the queue does, after "time" has passed?在“时间”过去之后,直到队列中的第一条消息处理后,第二个可运行文件才会得到处理吗?

No. The second runnable will be posted immediately and would execute before the first -- depending on the time parameter in the first, anyway.不,第二个可运行文件将立即发布并在第一个运行之前执行 - 无论如何,取决于第一个中的time参数。 If you post the first with a negligible delay for time it's possible it could execute first.如果您发布第一个time延迟可以忽略不计,它可能会先执行。 I don't believe there's any guarantee in place that it wouldn't.我不相信有任何保证它不会。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM