我们如何在Android中从logcat
读取活动名称?
我使用了一些代码,但没有获得我发布的Activity名称。
String baseCommand = "logcat -d time";
baseCommand += " ActivityManager:I "; // Info for my app
baseCommand += " *:S "; // Silence others
try
{
Process logReaderProcess = Runtime.getRuntime().exec(baseCommand);
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(logReaderProcess.getInputStream()));
while ((line = bufferedReader.readLine()) != null)
{
Log.e("This is Camera open log",""+log);
log.append(line); // here readLine() returns null
}
}
catch (IOException e1)
{
e1.printStackTrace();
}
有人可以建议一个解决方案吗?
答案 0 :(得分:1)
同一命令适用于从you can extract activity name from the tag "Activity Manager" which last appeared.