Android StackTrace Print printStackTrace(String TAG, Throwable ex)

Here you can find the source of printStackTrace(String TAG, Throwable ex)

Description

print Stack Trace

Declaration

public static void printStackTrace(String TAG, Throwable ex) 

Method Source Code

//package com.java2s;

import android.util.Log;

public class Main {
    public static void printStackTrace(String TAG, Throwable ex) {
        StackTraceElement[] sta = ex.getStackTrace();
        if (ex.getMessage() != null) {
            Log.e(TAG, ex.getMessage());
        }//  www. ja  va  2  s.  co m
        Log.e(TAG, ex.getClass().getName());
        for (StackTraceElement st : sta) {
            Log.e(TAG, "   " + st.getFileName() + "." + st.getMethodName()
                    + ": " + st.getLineNumber());
        }
    }
}