Advertisement
jasperlow

Untitled

Jun 10th, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. public void writeFile(String fname, String content) {
  2. File root = android.os.Environment.getExternalStorageDirectory();
  3. File dir = new File(root.getAbsolutePath());
  4. dir.mkdirs();
  5. File file = new File(dir, fname);
  6. try {
  7. FileOutputStream f = new FileOutputStream(file);
  8. PrintWriter pw = new PrintWriter(f);
  9. pw.println(content);
  10. pw.flush();
  11. pw.close();
  12. f.close();
  13. } catch (Exception e) {
  14. e.printStackTrace();
  15. MyLogs.jasper("" + e.getMessage());
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement