Reputation: 791
I am putting some predefined text in sms body and proceeding for SMS with below code
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);
so when it opens my SMS window it shows predefined text as
"Pssst, we are organizing an event in XYZ city. you can join us on http://example.com/invite.html. you gonna love this!"
but what i want is
"Pssst, we are organizing an event in XYZ city. you can join us on http://example.com/invite.html. you gonna love this!"
so basically i want a hyperlink at "http://example.com/invite.html"
Can any one help me out with this?
Upvotes: 0
Views: 2560
Reputation: 12358
Use in this manner
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);
or
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);
Automatically android detect links and hyperlink it by default.
Upvotes: 1