1. 程式人生 > >java層列印呼叫棧兩中方法

java層列印呼叫棧兩中方法

RuntimeException here = new RuntimeException("here"); here.fillInStackTrace(); Log.d("my_log", "Called: " + this, here); java.util.Map<Thread, StackTraceElement[]> ts = Thread.getAllStackTraces(); StackTraceElement[] ste = ts.get(Thread.currentThread()); for (StackTraceElement s : ste) {     Log.d("my_log", s.toString()); }