Android,非ui线程异常
无论如何,我是否可以设置 DDMS,以便它可以捕获 Eclipse 中非 ui 线程的异常?我花了很长时间才意识到,如果在非 ui 线程中发生异常,程序不会受到太大影响,至少就我而言是这样。基本上我有以下代码:
new Thread(new Runnable(){
public void run(){
A.errorMethod();
}
}).start();
当我运行应用程序时,它只是在执行 errorMethod 时停止,但没有显示异常消息。在我采取了 A.errorMethod(); 之后直接拿出来运行,Logcat里就出现了异常信息,奇怪。
Is there anyway that I could set the DDMS, so that it could capture exceptions from non-ui thread in eclipse? It took me long enough to realize that if an exception occur in non-ui thread, the program won't be effected much, at least in my case. Basically I have the following code:
new Thread(new Runnable(){
public void run(){
A.errorMethod();
}
}).start();
When I run the app,it just halt while doing errorMethod, but there is no exception message shown. After I took the A.errorMethod(); part out and run it directly, I got the exception message in Logcat, weird.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试让调试器绑定到线程使用:
try to let the debugger bind to the thread using: