萧十郎
/** * Launches a logcat process. * To stop the logcat preserve the use: * process.destroy(); * in the onBackPressed() * * @param filename destination of logcat output * @return Process logcaat is running on */ public Process launchLogcat(String filename) { Process process = null; String cmd = "logcat -f " + filename + "\n"; try { process = Runtime.getRuntime().exec(cmd); } catch (IOException e) { process = null; } return process; }