我想通过电子邮件分享以下代码。我之前能够看到URL的超链接。但目前,我无法点击该链接。它只是Gmail应用程序中的纯文本。
String text = "<a href=\"http://www.w3schools.com\"></a>";
Log.d("Share","Video : "+text);
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setData(Uri.parse("mailto:"));
emailIntent.setType("text/html");
emailIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Some Subject");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(text));
startActivity(Intent.createChooser(emailIntent, getString(R.string.send_mail)));
谢谢, 维奈
答案 0 :(得分:0)
尝试如下所示。
String link_value = "www.google.com"
String body = "<a href=\"" + link_value + "\">" + link_value+ "</a>"
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(body));
答案 1 :(得分:0)
无需定义html标记。 试试这个,
String text ="http://www.w3schools.com\";
Log.d("Share","Video : "+text);
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setData(Uri.parse("mailto:"));
emailIntent.setType("text/plain");
emailIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Some Subject");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, text));
startActivity(Intent.createChooser(emailIntent, getString(R.string.send_mail)));