Android examples for java.lang:Throwable
Convert Throwable to string
import java.io.PrintWriter; import java.io.StringWriter; import java.io.Writer; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main{ public static String getErrorInfo(Throwable arg1) { Writer writer = new StringWriter(); PrintWriter pw = new PrintWriter(writer); arg1.printStackTrace(pw);/*from ww w .j a v a2 s . c o m*/ pw.close(); String error = writer.toString(); return error; } }