Moa*_*had 2 debugging android breakpoints runnable android-studio
我需要调试我的应用程序,并调试runnable内的代码,并在应用程序中执行一些操作然后再次调试代码,但我不能这样做,我不能做任何操作,调试点立即激活.
代码:
public class UpdateHandler {
public static Handler getHandler() {
if (sHandler == null) {
HandlerThread looper = new HandlerThread("update Handler");
looper.start();
sHandler = new Handler(looper.getLooper());
}
return sHandler;
}
}
UpdateHandler.getHandler().post(new Runnable() {
@Override
public void run() {
update();
}
});
public void update() {
// i put the debug point here .
}
Run Code Online (Sandbox Code Playgroud)
对于runnables/async任务等Debug.waitForDebugger(),在您设置断点的代码之前调用是很有用的:
...
Debug.waitForDebugger();
foo.bar(); # breakpoint on this line
...
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1500 次 |
| 最近记录: |