I need to dump logcat with filter programmatically. I applied adb logcat -s "TAGNAME" but the app just "hung". there is a similar thread but there is no solution: Read filtered log cat(Programmatically)?
try {
Process process = Runtime.getRuntime().exec("logcat -s XXX");
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(process.getInputStream()));
StringBuilder log = new StringBuilder();
String line;
while ((line = bufferedReader.readLine()) != null) {
log.append(line);
log.append(FragmentLog.LINE_SEPARATOR);
}
((TextView) tv).setText(log.toString());
} catch (IOException e) {
((TextView) tv).setText(R.string.default_blank);
}