Created
February 27, 2014 12:30
-
-
Save paour/9249178 to your computer and use it in GitHub Desktop.
Easy send attachment via email
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BufferedWriter bw = new BufferedWriter(new FileWriter(file)); | |
bw.write(sb.toString()); | |
bw.close(); | |
Intent sendIntent = new Intent(Intent.ACTION_SEND); | |
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "MyTrails state dump"); | |
sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{"[email protected]"}); | |
sendIntent.putExtra(Intent.EXTRA_TEXT, "See attachment"); | |
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + file.getAbsolutePath())); | |
sendIntent.setType("text/plain"); | |
startActivity(Intent.createChooser(sendIntent, "Send state via email")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment