Android examples for java.lang:Throwable
get Error Stack Trace Message
//package com.java2s; import java.io.PrintWriter; public class Main { public static void getErrorStackTraceMessage(StackTraceElement stack[], PrintWriter pw, int count) { int ix = stack.length - 1; int c = count; while (ix > 0) { StackTraceElement frame = stack[ix]; String cname = frame.getClassName(); if (cname.equals("java.util.logging.Logger")) { break; }/*from www . j a va2s . c o m*/ String mname = frame.getMethodName(); int linenumber = frame.getLineNumber(); pw.print(cname + ":" + mname + ":" + linenumber); pw.print("\n"); c--; if (c < 1) break; ix--; } } }