开发者

how to see the log file in android

I want a code for creating the log file in android and at the run time where to check where this log file is getting created, I also example for the sa开发者_高级运维me in java

Can we create a log file using predefined functions in android itself


You can start your own process of logcat on the device, and redirect the output to some file. This is the basics ( do it on a separate thread)

Process logcat = Runtime.getRuntime().exec("logcat"); // start process
BufferedReader reader = new BufferedReader( new InputStreamReader(logcat.getInputStream())); // grab output stream
// store to file or print to screen


Refer to Log and LogCat.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜