Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
305 views
in Technique[技术] by (71.8m points)

html - Use Table tag in Android Email

I want my app to construct some HTML and pass it over to an email so my user can send it to whomever they want. I found code on the web that shows how to pass the html via an Intent, but it appears that Html.fromHtml(String source) doesn't understand table tags. Is there anyway I can format an email with table tags? I want to send it through the user's preferred client instead of sending it myself with javamail.

final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("text/html");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(body));
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
activity.startActivity(Intent.createChooser(emailIntent, "Email:"));

Any suggestions?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Unfortunately, the <table> tag isn't supported. Supported tags are actually more dependent on the email client you use to send the email - some of them are more finicky/restrictive than others. Most of them use the super-basic formatting tags like <b>, <i>, <h1>, and so on, though. The more layout-oriented tags are a lot more spotty, and some (like <table>) aren't supported at all.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...