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.
精彩评论