Kartik Bhatt Kartik Bhatt - 1 year ago 122
Android Question

Save Data of LogCat in android

I want to save all the contents of log cat into specific file in Android.
I used Eclipse IDE to develop the android application.

How i can achieve this ?


Answer Source

Here is a way to get the Logcat contents progrmatically.

 Process process = Runtime.getRuntime().exec("logcat -d");

 BufferedReader bufferedReader = new BufferedReader(
     new InputStreamReader(process.getInputStream()));

 StringBuilder log=new StringBuilder();
 String line = "";
 while ((line = bufferedReader.readLine()) != null) {

Check this link for more details.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download