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);
i.setType("text/html");
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/>");
body.append(text).append("<br/><br/>").append(url)
.append("<br/><br/>App!");
i.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(body.toString()));
} else {
final StringBuilder body = new StringBuilder("\n");
body.append(text).append("\n\n").append(url).append("\n\n")
.append("\n\nApp!");
i.putExtra(Intent.EXTRA_TEXT, body.toString());
}
ctx.startActivity(Intent.createChooser(i, "Select email application"));
}
}
Related examples in the same category