刚出现一个奇怪的问题,相同的代码在以前的版本中运行良好,但最近的gmail(版本-7.5.7.156101332.release)更新不支持Html标签。
以下是代码:
public static void sendMail(Activity activity){
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("text/html");
i.putExtra(Intent.EXTRA_EMAIL , new String[]{"recipient@example.com"});
i.putExtra(Intent.EXTRA_SUBJECT, "subject of email");
i.putExtra(Intent.EXTRA_TEXT , Html.fromHtml("<html><body><h1>Title</h1>body of email<br>New line</body></html>"));
try {
activity.startActivity(Intent.createChooser(i, "Send mail..."));
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(activity, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
}
}