如何调试Android的回调? [英] How to debug android callbacks?

查看:159
本文介绍了如何调试Android的回调?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用Eclipse调试器调试我的Andr​​oid应用程序,但它似乎并不奏效。我在我的 MasterActivity.java 文件中的回调 onOptionsItemSelected ,和我在一个点设置在这个方法中设置断点我知道是被击中。然后我右击我的应用程序,并转到调试方式 - > Android应用程序。当我点击触发这个回调,应该启动调试过程中的ActionBar按钮,我的程序只是继续像我断点是不存在的。我必须在这里失去了一些东西基本的,但我不知道是什么。

I am trying to use the Eclipse debugger to debug my Android application, but it doesn't seem to be working. I have a callback in my MasterActivity.java file for onOptionsItemSelected, and I set a breakpoint in this method at a point that I know is being hit. I then right click my application, and go to Debug As -> Android Application. When I click the button in the ActionBar that triggers this callback and should start the debugging process, my program just continues like my breakpoint is not there. I must be missing something basic here, but I'm not sure what.

推荐答案

西蒙的建议添加日志信息是一个良好的开端,以确保回调被调用,除非已经有独特的回调一些其他的证据表明,这被触发。我们只能猜测,你还没有加入任何code,并没有浪费时间像一个程序员假设他们是正确的,包括我自己; - )

Simon's suggestion to add a Log message is a good start to ensure that the callback is being called, unless there is already some other evidence unique to the callback that it is being triggered. We can only guess as you haven't included any code, and nothing wastes time like a programmer assuming they are correct, myself included ;-)

但是,尝试添加调用了waitForDebugger() 之前,为了有断点主动行。

However, try adding a call to waitForDebugger() just prior to the line with the breakpoint active.

这篇关于如何调试Android的回调?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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