Android 调试技巧之打印堆栈

用法一

Thread.dumpStack();


Note:

java.lang.Thread

    /**
     * Prints a stack trace of the current thread to the standard error stream.
     * This method is used only for debugging.
     *
     * @see     Throwable#printStackTrace()
     */
    public static void dumpStack() {
        new Exception("Stack trace").printStackTrace();
    }


用法二

new Exception("关键字").printStackTrace();

你可能感兴趣的:(Java,基础)