Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2014
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. File path = new File(Environment.getExternalStorageDirectory(), "Folder");
  2. if (!path.exists()) {
  3. path.mkdirs();
  4. }
  5.  
  6. File exportFile = new File(path, fileName);
  7. FileWriter writer = new FileWriter(exportFile);
  8. writer.append(body);
  9. writer.flush();
  10. writer.close();
  11.  
  12. Intent intent = new Intent();
  13. intent.setAction(Intent.ACTION_SEND);
  14. intent.setType("text/plain");
  15. intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(exportFile));
  16. startActivity(intent);
  17.  
  18. File path = new File(this.getFilesDir(), "exports");
  19. if(!path.exists()){
  20. path.mkdir();
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement