Welcome Android Developpers

Welcome Android Developpers
My name is Mathias Séguy, I am an Android Expert and Trainer and created the Android2EE company.

For full information, it’s here : Android2EE's Training
You can meet me on Google+, follow me on Twitter or on LinkedIn
Showing posts with label Email. Show all posts
Showing posts with label Email. Show all posts

Tuesday, November 15, 2011

How to send an Email O_o'


Bandeau Conference
Hello,
To send an email, just use the code below:

//load string for email:

String[] adresses=getResources().getStringArray(R.string.mail_adresses);
String subject=getResources().getString(R.string.mail_subject);
String body=getResources().getString(R.string.mail_body);

// send an email
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("plain/text");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, adresses);
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, body);
startActivity(Intent.createChooser(emailIntent, "Send mail..."));

Notice that you are using Intent to call the Emails' sender activity.

So, Thanks who?
Thanks, Android2ee, the Android Programming Ebooks :o)

Mathias Séguy
mathias.seguy.it@gmail.com
Auteur Android2EE
Ebooks to learn Android Programming.
AndroidEvolution