When sending HTML formatted text with HTML.fromHtml()
and put into the intent flag ACTION_SEND
the HTML-formatted string won't be displayed correctly for the default email client for devices like the samsung note 2 and all htc devices. But if i choose gmail app then my html text is rendering fine. I tried setting Mail size to maximum but that didn't help either.
当使用HTML.fromHtml()发送HTML格式的文本并将其放入意图标志ACTION_SEND时,对于像三星音符2和所有htc设备这样的设备的默认电子邮件客户端,HTML格式的字符串将无法正确显示。但如果我选择gmail应用程序,那么我的HTML文本就可以正常呈现。我尝试将邮件大小设置为最大,但这也没有帮助。
String message = "<p><b><i><a href=\"https://play.google.com/\">My App</a> Some text.</i></b></p>";
Intent email = new Intent(Intent.ACTION_SEND);
email.putExtra(Intent.EXTRA_SUBJECT, subject);
email.setType("message/rfc822");
email.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(message));
startActivity(Intent.createChooser(email, "Choose an Email client :"));
1 个解决方案
#1
0
Try it may useful: First convert string into HTML format:
尝试它可能有用:首先将字符串转换为HTML格式:
String message = Html.fromHtml("<p><b><i><a href=https://play.google.com/>My App</a> Some text.<i></b></p>").toString();
Then put message
into method
然后将消息放入方法中
Intent email = new Intent(Intent.ACTION_SEND);
email.putExtra(Intent.EXTRA_SUBJECT, subject);
email.setType("message/rfc822");
email.putExtra(Intent.EXTRA_TEXT, message);
startActivity(Intent.createChooser(email, "Choose an Email client :"));
Thanks....
#1
0
Try it may useful: First convert string into HTML format:
尝试它可能有用:首先将字符串转换为HTML格式:
String message = Html.fromHtml("<p><b><i><a href=https://play.google.com/>My App</a> Some text.<i></b></p>").toString();
Then put message
into method
然后将消息放入方法中
Intent email = new Intent(Intent.ACTION_SEND);
email.putExtra(Intent.EXTRA_SUBJECT, subject);
email.setType("message/rfc822");
email.putExtra(Intent.EXTRA_TEXT, message);
startActivity(Intent.createChooser(email, "Choose an Email client :"));
Thanks....