在开发Android时,如何在AsyncTask中使用Eclipse调试器? [英] How do I use the Eclipse debugger in an AsyncTask when developing for Android?
本文介绍了在开发Android时,如何在AsyncTask中使用Eclipse调试器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
MainMenu.oncreate(类Activity)
中放置一个断点来验证我的调试器是否正常工作。但是当我将它放在我的 AsyncTask.doInBackground
的第一行中时,它从来没有打过它。我知道它正在运行,因为我将一个Log语句放在 AsyncTask
中,并显示在LogCat中。任何帮助将不胜感激,因为我喜欢调试器在日志记录上。 我的版本:
Eclipse SDK版本:3.6.1
构建ID:M20100909-0800
解决方案
将以下代码片段放在开头的 doInBackground
中:
那么当你在该线程中设置一个断点时,eclipse会找到它。
>
I'm running ADT (Android Development Tools) in Eclipse and verified that my debugger is working by putting a breakpoint in MainMenu.oncreate (class Activity)
. But when I put it in the first line of my AsyncTask.doInBackground
, it never hits it. I know it's running because I put a Log statement in the AsyncTask
and it shows up in LogCat. Any help would be appreciated as I prefer the debugger over the logging.
My versions:
Eclipse SDK Version: 3.6.1
Build id: M20100909-0800
解决方案
Put the following code fragment in the beginning of doInBackground
:
android.os.Debug.waitForDebugger();
Then when you set a breakpoint in that thread, eclipse will find it.
这篇关于在开发Android时,如何在AsyncTask中使用Eclipse调试器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文