Opening an email client on clicking a button
To show only email clients use this code:
Intent intent = new Intent(Intent.ACTION_VIEW);
Uri data = Uri.parse("mailto:[email protected]?subject=" + Uri.encode(subject) + "&body=" + Uri.encode(body));
intent.setData(data);
startActivity(intent);
If you already chose default email client then it will launch it. Otherwise it will show a list of available email clients.
Goes like this:
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("plain/text");
intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "[email protected]" });
intent.putExtra(Intent.EXTRA_SUBJECT, "subject");
intent.putExtra(Intent.EXTRA_TEXT, "mail body");
startActivity(Intent.createChooser(intent, ""));
Alternatively, you could use IntentFactory.getSendEmailIntent(String mailTo, String mailCC, String subject, CharSequence body, File attachment).
If you have a e-mail address on screen, you can just use in your xml, like this:
android:autoLink="email"