0


I'm using intent.putextra() to share the intent to Facebook and Twitter. But I have a simple question: is it possible to insert a clickable link into the string used in putextra()?
Let's make an example. This code:

Intent shareintent = new Intent();
shareintent.setAction(Intent.ACTION_SEND);
shareintent.putExtra(Intent.EXTRA_TEXT, "Whatever");
shareintent.setType("text/plain");
startActivity(shareintent);

will share "Whatever" to the selected service. I just want to put something like the "a href" tag used in HTML so that I can set a link that redirects the user to a specific page...
Any idea?

UPDATE: appearantly when the choosen sharing method starts it doesn't have the content I put into putextra...
For example: if I choose Facebook the intent opens a blank post page instead of posting "Whatever"... o.O

Leon
  • 665
  • 4
  • 10
  • 32
  • Maybe you are searching for [a link text view](http://stackoverflow.com/questions/17877595/i-want-text-view-as-a-clickable-link)? – Manuel Spigolon Apr 09 '14 at 09:27
  • hmmm nope. I want the text to be clickable when already shared. For example: when I share "whatever" on FB I want other FB users to be able to click on it and be redirected to a page... – Leon Apr 09 '14 at 09:37

1 Answers1

0

is it possible to insert a clickable link into the string used in putextra()?

The way you code, makes the link clickable or not. You can send the link-text to next activity using intent as shown in your example. And in next activity you can make that link clikable and navigate to desired page.

EDIT:

well I can't make the link clickable in the next activity because the next activity is an other app

In that case you need to put a URL in the EXTRA_TEXT field. But if you put only simple text then it won't be clickable in Facebook. However it will work in Twitter.

Check following links.

  1. Android-and-facebook-share-intent

  2. Unable to share text with link

Community
  • 1
  • 1
Ritesh Gune
  • 16,629
  • 6
  • 44
  • 72
  • well I can't make the link clickable in the next activity because the next activity is an other app (used to share the content) xD – Leon Apr 09 '14 at 09:41
  • I have updated my answer with few useful links. Hope it helps you. – Ritesh Gune Apr 09 '14 at 09:48