-1

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);
}
Ashish Jha
  • 173
  • 1
  • 3
  • 18

1 Answers1

0

check this, below code works for me

Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT,
                "Hey check out my app at: https://play.google.com/store/apps/details?id=com.osmanaslanoglu.kizane");
sendIntent.setType("text/plain");
startActivity(sendIntent);
Umer Farooq
  • 583
  • 3
  • 17