Andrea Mario Lufino Andrea Mario Lufino - 1 year ago 162
Android Question

Android - Share on Facebook, Twitter, Mail, ecc

i need to develop an app that has the share function. I have to share on Facebook, twitter, email and maybe other services. How can i do this? There a library on the net? For the iOS development there were ShareKit, but for Android??
Thanks :)

Answer Source

Paresh Mayani's answer is mostly correct. Simply use a Broadcast Intent to let the system and all the other apps choose in what way the content is going to be shared.

To share text use the following code:

String message = "Text I want to share.";
Intent share = new Intent(Intent.ACTION_SEND);
share.putExtra(Intent.EXTRA_TEXT, message);

startActivity(Intent.createChooser(share, "Title of the dialog the system will open"));
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download