LogCat中的android系统中保存数据 [英] Save Data of LogCat in android

查看:146
本文介绍了LogCat中的android系统中保存数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要记录的猫的所有内容保存到Android中的特定文件。 我使用Eclipse IDE开发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 ?

感谢。

推荐答案

下面是一个办法让logcat的内容progrmatically。

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) {
     log.append(line);
 }

检查<一href="http://www.$c$crzheaven.com/2011/07/16/how-to-read-logcat-contents-programmatically-in-android/">this链接查看更多细节。

Check this link for more details.

这篇关于LogCat中的android系统中保存数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆