Android ACTION_SEND Hyperlink not working in GMail

為{幸葍}努か 提交于 2019-12-10 04:22:51

问题


This is my code for sending an HTML email in Android, with a clickable link.

private void sendEmail()
{

Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
String subject = "Prueba";
String emailtext = "<a href=http://www.google.es>PruebaEmail</a>";
emailIntent.setType("message/rfc822");
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(emailtext.toString()));

startActivity(Intent.createChooser(emailIntent, "Send mail"));
}

Months ago, it was working and sends a clickable hyperlink, but for now, when I receive the mail in my GMail account, there is no hyperlink, just plain text.

I have tried all of this in the type:

emailIntent.setType("message/rfc822");

and

emailIntent.setType("plain/text");

and

emailIntent.setType("text/html");

and this for the text:

String emailtext = "<a href=http://www.google.es>PruebaEmail</a>";

and

String emailtext = "<a href='http://www.google.es'>PruebaEmail</a>";

and

String emailtext = "<a href="http://www.google.es">PruebaEmail</a>";

but none of that are working.

This issue is just for GMail, because if I send the mail to Evernote or another app, I got a clickable link.

This is my API configuration:

<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="8"/>

and compiling with Android 3.2

Any ideas?


回答1:


OK finally found the solution for the things to work. The link in the href and outside has to be exactly same. Deleted my comments they are now irrelevant.

The problem is with gmail client 4.2.2 i have the latest one it seems :) The gmail client 4.1.2 worked just fine for the href tag what you had written.

And its really stupid of the gmail client to work like this.



来源:https://stackoverflow.com/questions/14560717/android-action-send-hyperlink-not-working-in-gmail

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!