Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void appendLog(String text)
- {
- File logFile = new File("sdcard/log.file");
- if (!logFile.exists())
- {
- try
- {
- logFile.createNewFile();
- }
- catch (IOException e)
- {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- try
- {
- //BufferedWriter for performance, true to set append to file flag
- BufferedWriter buf = new BufferedWriter(new FileWriter(logFile, true));
- buf.append(text);
- buf.newLine();
- buf.close();
- }
- catch (IOException e)
- {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
Add Comment
Please, Sign In to add comment