start Html Email Intent : Email « Network « Android

start Html Email Intent

import android.content.Context;
import android.content.Intent;
import android.text.Html;

class UIHelper {

  public static void startHtmlEmailIntent(final Context ctx,
      final String email, final String subject, final String text,
      final String url) {
    final Intent i = new Intent(Intent.ACTION_SEND);

    if (email != null)
      i.putExtra(Intent.EXTRA_EMAIL, new String[] { email });

    i.putExtra(Intent.EXTRA_SUBJECT, subject);

    boolean useHtmlEmail = true;
    if (useHtmlEmail) {
      final StringBuilder body = new StringBuilder("<br/>");

      i.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(body.toString()));
    } else {
      final StringBuilder body = new StringBuilder("\n");

      i.putExtra(Intent.EXTRA_TEXT, body.toString());
    ctx.startActivity(Intent.createChooser(i, "Select email application"));


Related examples in the same category

1.Email vis Intent
2.Builds a list of the recipients email addresses each on a different line
3.Is string an Email address
4.Send email
5.isValidEmailAddress: Check the email address is Valid
6.Launch the email intent
7.start Email Intent