在哪里可以找到等候在Android上的消息队列中的消息? [英] Where can I find pending message on the message queue in android?

查看:238
本文介绍了在哪里可以找到等候在Android上的消息队列中的消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法找出消息队列的大小,什么产品每个消息吗?它是 Looper.getMainLoop 还是什么?

Is there a way to find out the message queue size and what item is in each message? Is it Looper.getMainLoop or something?

推荐答案

希望这不是太迟了一个答案。您可以访问当前线程的消息队列调用Looper.myQueue()就可以了。然而,MessageQueue类没有任何方法,找出它的大小或什么产品的每个邮件中。为了这个目的,你可以尝试将处理程序类。处理程序管理一个活套,其中有一个队列,该处理程序有一个像hasMessages,obtainMessage,removeMessages等方法。我认为这是你最好的拍摄。

Hope it's not too late for an answer. You can access the current thread's message queue calling Looper.myQueue() on it. However, the MessageQueue class has no methods to find out its size or what item is in each message. For that purpose, you could try the Handler class. A handler manages a looper, which has a queue, and that handler has methods like hasMessages, obtainMessage, removeMessages, and so on. I think that is your best shot.

这篇关于在哪里可以找到等候在Android上的消息队列中的消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆