Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("plain/text");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{ "youremail@gmail.com"});
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Checkins today");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Here you go.");
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+Environment.getExternalStorageDirectory()+"/barcodes/checkins.txt"));
emailIntent.setType("text/csv");
startActivity(Intent.createChooser(emailIntent, "Send mail..."));
It's looking more and more like this thing will be ready for prime-time before the B5s race next week. Todd might be pleasantly surprised if he gets the check-ins before the race starts.Wednesday, April 6, 2011
Nice and Smooth - Sending email
After having a horrible time with permissions last night, I moved on to figuring out how to send an email with an attachment. It turns out that this is the easiest thing that I've done on Android so far! I just had to create an Intent to ACTION_SEND, add some parameters that are pretty standard, and start her up.
Here's the code:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment