我在sms正文中放置了一些预定义的文本,并使用以下代码继续进行短信
Intent smsIntent = new Intent(Intent.ACTION_SENDTO, Uri
.parse("smsto:" + unsuccessContacts));
smsIntent.putExtra("sms_body","Pssst, we are organizing an event in XYZ city. you can join us on http://example.com/invite.html. you gonna love this!");
startActivityForResult(smsIntent, SEND_SMS);
因此,当它打开我的短信窗口时,它会将预定义文本显示为
" Pssst,我们正在XYZ市举办活动。您可以通过http://example.com/invite.html加入我们。你会喜欢这个!"
但我想要的是
" Pssst,我们正在XYZ市举办活动。您可以http://example.com/invite.html加入我们。你会喜欢这个!"
所以基本上我想要一个超链接在" http://example.com/invite.html"
任何人都可以帮我解决这个问题吗?
答案 0 :(得分:1)
以这种方式使用
Intent smsIntent = new Intent(Intent.ACTION_SENDTO, Uri
.parse("smsto:" + unsuccessContacts));
smsIntent.putExtra("sms_body","Pssst, we are organizing an event in XYZ city. you can join us on http://example.com/invite.html. you gonna love this!"));
startActivityForResult(smsIntent, SEND_SMS);
或
SmsManager smsManager = SmsManager.getDefault();
String text = "Pssst, we are organizing an event in XYZ city. you can join us on http://example.com/invite.html. you gonna love this!";
smsManager.sendTextMessage(number, null, text, null, null);
默认情况下,自动检测链接并将其超链接。