Skip to content Skip to sidebar Skip to footer

Android - Sharing Html To Whatsapp & Email

I would like to create a option in my app to share a HTML generated page to WhatsApp & Email, but i can't seem to be able make it share with formatting (tables are not working)

Solution 1:

there is not HTML format of whatsapp message. On the other hand you can send HTML formatted e-Mail. It has some restrictions like you have to use in-line styles. But any how you can send a HTML formatted e-Mail by using ACTION_SENDTO intent.

The code look like this

final Intent shareIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:"));
shareIntent.putExtra(Intent.EXTRA_SUBJECT, "The Subject");
shareIntent.putExtra(
Intent.EXTRA_TEXT,
Html.fromHtml(new StringBuilder()
    .append("<p><b>Some Content</b></p>")
    .append("<small><p>More content</p></small>")
    .toString())
);

Post a Comment for "Android - Sharing Html To Whatsapp & Email"