如何为Android开发,当我使用Eclipse调试器中的AsyncTask?当我、何为、器中、AsyncTask

2023-09-12 08:45:53 作者:最甜蜜の温柔

我在Eclipse中运行ADT(Android开发工具),并验证了我的调试器是通过把断点 MainMenu.oncreate(课堂活动)工作。但是,当我把它放在我的 AsyncTask.doInBackground ,它永远不会打它的第一道防线。我知道它的运行,因为我把在的AsyncTask 日志报表,并将其显示在LogCat中。任何帮助将是AP preciated我preFER调试过的记录。

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.

我的版本:

Eclipse SDK Version: 3.6.1  
Build id: M20100909-0800

推荐答案

将下面的code片段的开头 doInBackground

Put the following code fragment in the beginning of doInBackground:

android.os.Debug.waitForDebugger();

然后,当你设置在该线程断点; Eclipse会找到它。

Then when you set a breakpoint in that thread; eclipse will find it.