Android Boy
Android Boy

Reputation: 4345

Get Logcat of Particular Application

Can Anybody tell me how we can got the Logcat of particular application. I want to be create an application in which user choose the name of application e.g. radio, Facebook, Navigation etc. After choosing it user click on the button. After clicking on the button the log of the chosen application can be got in file or in any form...!!!

Thanx in Advance

Upvotes: 1

Views: 1419

Answers (1)

user370305
user370305

Reputation: 109237

Try this,

   String baseCommand = "logcat -v time";

        try {
              Process logReaderProcess = Runtime.getRuntime().exec(baseCommand);
              BufferedReader bufferedReader = new BufferedReader(
               new InputStreamReader(logReaderProcess.getInputStream()));

               while ((line =bufferedReader.readLine()) != null) {
                        log.append(line); // here readLine() returns null
                      }

        }
        catch (IOException e1) {
                  // TODO Auto-generated catch block
                  e1.printStackTrace();
                }

Upvotes: 3

Related Questions