I have given a 'Share With' option in my application. And when the user clicks on that, lets suppose user selects, 'Share With' WhatsApp or Twitter, I am showing a custom message template that appears by default in the message, just when WhatsApp or Twitter launches. I have a message and a link in that. I want to make that link clickable. Right now both message and link are coming as string. Can anyone help me in achieving that.
I will simplify:
Current: "Welcome to Google https ://google.com"
Required: "Welcome to Google" https://google.com (link should appear in blue and should be clickable)
My code is below:
private void redirectUserToShareWith() {
Intent referIntent = new Intent();
referIntent.setAction(Intent.ACTION_SEND);
String dynamicUrl = "https://google.com";
String linkedText = String.format("<a href=\"%s\">link</a> ", dynamicUrl);
referIntent.putExtra(Intent.EXTRA_TEXT, mCtx.getString(R.string.message_body) + Html.fromHtml(linkedText));
referIntent.setType("text/plain");
mCtx.startActivity(referIntent);
}