Reputation: 121
How we can Read Activity name from logcat
in Android?
I used some code but didn't get Activity name which I launched.
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();
}
Can someone please suggest a solution?
Upvotes: 1
Views: 717
Reputation: 109237
The same command works for getting Activity Manager info from adb logcat now from that you can extract activity name from the tag "Activity Manager" which last appeared.
Upvotes: 1