RuntimeException e = new RuntimeException("leon is here");
e.fillInStackTrace();
Slog.i(TAG, "xxx" + value, e);
或者是下面的方法:
if (DEBUG) {
StackTraceElement[] stack = new Throwable().getStackTrace();
for (StackTraceElement stackTraceElement : stack) {
Slog.d(TAG, "----> " + stackTraceElement.toString());
}
}
Android framework 在线调试比较困难,不好设置断点查看调用堆栈。
使用上面的代码可以将对应方法的所有调用过程打印出来。
参考:http://blog.sina.com.cn/s/blog_769500f001019fy5.html