如何为Android开发,当我使用Eclipse调试器中的AsyncTask? [英] How do I use the Eclipse debugger in an AsyncTask when developing for Android?

查看:202
本文介绍了如何为Android开发,当我使用Eclipse调试器中的AsyncTask?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在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.

这篇关于如何为Android开发,当我使用Eclipse调试器中的AsyncTask?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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