Android的 - 在Facebook上分享,微博,邮件,ECC邮件、Facebook、Android、ECC

2023-09-11 20:26:58 作者:方长

我需要开发一个应用程序,具有共享功能。我给大家分享在Facebook,微博,电子邮件,也许等服务。我怎样才能做到这一点?有网上图书馆?对于iOS开发有ShareKit,但对于Android? 感谢:)

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 :)

推荐答案

帕雷什Mayani的回答多半是正确的。只需使用一个广播意图让系统和所有其他的应用程序用什么样的内容将被共享的选择。

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.

要共享文本使用下面的code:

To share text use the following code:

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

startActivity(Intent.createChooser(share, "Title of the dialog the system will open"));