Reputation: 1429
I'm developing an app. I want to share text and links in facebook, twitter etc using intents. I'm not sure how to send them both.
Intent s = new Intent(android.content.Intent.ACTION_SEND);
s.setType("text/plain");
s.putExtra(Intent.EXTRA_SUBJECT, "SAmple");
s.putExtra(Intent.EXTRA_TEXT, "");
startActivity(Intent.createChooser(s, "Quote"));
If I add <a href=#>SAmple</a>
, then it is not parsed as a link.
Can u guide me please!
Upvotes: 3
Views: 9420
Reputation: 37729
With the type specified in
s.setType("text/plain");
You can only send plain text. and if you want to support of HTML format you will modify the type as:
s.setType("text/html");
but this can limit your choices in Intent Chooser dialog (i.e may be only Gmail or none).
This is because it depends on which type of Intent
installed application can handle. As far as I know facebook, twitter etc doesn't handle such type of Intent
.
So the solution is: you can concatenate the Link at the end of Text message using s.setType("text/plain");
to have more Intent receivers.
Upvotes: 10