This message is already in use.的解决方法
在开发项目的时候遇到报错This message is already in use.然后我看了下是和handler发送Message相关的,于是我就在网上找解决办法。其实意思就是说,这个消息已经在消息队列了,而且正被使用,而如果往同一个队列发送相同的西哦奥西对象就会报错。
这样,解决就很简单了,我们只需要判断这个消息是否在队列中有了,有了我们new一个一模一样的消息对象,然后发出去,这样就不会报错了。
下面贴出我之前的代码和修改后的代码:
报错的:
public void onMessage(Message msg) { handler.sendMessage(msg); }
修改后的:
public void onMessage(Message msg) { if(handler.obtainMessage(msg.what, msg.obj) != null){ Message _msg = new Message(); _msg.what = msg.what; _msg.obj= msg.obj; msg = _msg; // return; } handler.sendMessage(msg); }
这样问题就解决了,当然效果怎么样我这里没测试,希望对大家有帮助。
相关推荐
(This is a little bit of a white lie, as modern routers sometimes act as firewalls or caching components, and process Transport layer as well.) Link layer switches process link and physical layers ...
Note: the stl vector is used in this assignment, if you have any difficulties, you can refer to the documents given in this folder. Submission Submit only the following. 1. hashset.cpp – your ...
stands for Internet Message Access Protocol, and is currently in version 4, also known as IMAP4. When using IMAP, your mail server must support the protocol. You can't just change your program to ...
Encodes the specified URL for use in the sendRedirect method or, if encoding is not needed, returns the URL unchanged. encodeUrl(String) - Method in class javax.servlet....
1)....Fixed: Confusing message in Manage tool when using with Trial/Pro 2)....Fixed: Range check error in processes information for x64 machines (affects startup of any EurekaLog-enabled module) 3)......
Note: the stl vector is used in this assignment, if you have any difficulties, you can refer to the documents given in this folder. Submission Submit only the following. 1. hashset.cpp – your ...
Now it is possible to define is the drawing take place via WMPaint or via the PaintTo direct call (if rcPaint contain non-empty rectangle then WMPaint in progress). - FIX: The TFlexPanel.FPaintCache ...
make use of the CAN implementations that are already available on the market, or of new controllers that implement both formats. In order to distinguish standard and extended format the first reserved...
in production environments and one that is recommended to be used in ; development environments. ; php.ini-production contains settings which hold security, performance and ; best practices at its ...
This specification was developed in response to a perceived need for a standardized programming inter-face to digitizing tablets, three dimensional position sensors, and other pointing devices by a ...
This file is copied to $HOME/apktool/framework/1.apk during use. Warning Apktool has no knowledge of what version of framework resides there. It will assume its up to date, so delete the file ...
This is true not only from within GNU, but also in a great deal of proprietary and free software. Using a common language is quite handy for communication between developers, maintainers and users ...
# This is a root file system for linux 0.11 kernel. # Rebuild from materials gathered from Internet. # # Zhao Jiong ( gohigh@sh163.net ) # http://oldlinux.org/ 2004.1.4 # Third ...
If a match is found, it knows that resource is already locked. Some of the resources have “sub-resources.” The followings are sub-resources displayed by the sp_lock output: Database Lock Sub-...
[1] This paper will provide such a project model and is donated to the FreeBSD Documentation project where it can evolve together with the project so that it can at any point in time reflect the way ...
Note, it is in bytes in second, so if you want to monitor 1Mbit line it should be set a little higher than 131072 Reverse option - changes direction of graph. Show traffic in Bytes / Bits - ...
Please note: In rare cases this installation may fail with a message to check a log file for more details and it may remain partially installed. This may cause an "already installed" error when you ...
* In 99% of all cases where this happens the issue is caused by markup errors in the page where the plugin is used. Please validate your blog using [validator.w3.org](http://validator.w3.org) and fix ...
Like many of my colleagues in this industry, I learned Windows programming from Charles Petzold's Programming Windows—a classic programming text that is the bible to an entire generation of Windows ...
2- Once the log4erl directory is included, you can use its API as described in section "API". but before, you need to run: > application:start(log4erl). 3- Create a configuration file and load it ...