开发者

Android: How to do idle processing like some onIdle?

Here's my case,

  1. my app ran an internal event loop, which processed some custom events
  2. I invoked it at OnIdle() to handle events in another Win32 implementation, so that it could get triggered if there's no more system events to process, and try to handle them if there's any pending internal events, then exit loop and waited for another idle coming. This was how it's supposed to work.

As for Android, I'd like to do it in same way, but I didn't figure out how to do such idle pro开发者_运维问答cessing. How to get it?

Thanks.


Create a Handler in your activity's onCreate method. Write your idle processing to do a chunk of work and then call the handler's post or postDelayed method passing a Runnable to do the next chunk. The next chunk won't execute until after any pending events are processed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜