As a coder, I am always handling exceptions or errors,or in a word throwables. To impove the release build, I need to collect every throwable information.
And I need to get the information as string and post it to the Bug Collect Server. Now here is an easy trick to get stacktrace from a Throwable



private String getStackTrace(Throwable t) {
final Writer result = new StringWriter();
final PrintWriter printWriter = new PrintWriter(result);
t.printStackTrace(printWriter);
return result.toString();

Others