Android007
Android007

Reputation: 121

How to read Activity name from log cat in android?

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

Answers (1)

user370305
user370305

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

Related Questions