Kartik Bhatt Kartik Bhatt - 11 months ago 89
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 ?



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.