[英]How can I add a hyperlink to this email being created in Android app?
I would like to add a hyperlink to an email message which I will be creating as below.我想添加一个指向 email 消息的超链接,我将创建如下。 How could this be completed?
这怎么可能完成? I have tried various attempts to set as HTML which have been unsuccesful.
我尝试了各种设置为 HTML 的尝试,但均未成功。
String message = "\n\n <a href=\"www.apple.com\">Click Here to Open</a>";
Intent email = new Intent(Intent.ACTION_SEND);
email.putExtra(Intent.EXTRA_EMAIL, new String[]{ selectedEmail});
email.putExtra(Intent.EXTRA_SUBJECT, subject );
email.putExtra(Intent.EXTRA_TEXT, message));
email.setType("message/rfc822");
startActivity(Intent.createChooser(email, "Choose an Email client:"));
you are trying to include HTML in a java file, it will not work.您试图在 java 文件中包含 HTML ,它将不起作用。 For your purpose, you need to create a textView with the text as "click here to open" and to it attach an onClickListener() within which you can start your intent.
出于您的目的,您需要创建一个textView ,其文本为“单击此处打开”,并在其中附加一个onClickListener() ,您可以在其中启动您的意图。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.