在我正在开发的应用程序中,有4个图标显示了社交网络应用按钮,如Facebook、Twitter、linkedIn和Google+。现在点击这些按钮,我需要在相应的社交网络应用程序中发布url和文本。
当我点击facebook按钮URL和文本(我们的目标是.)必须在facebook上发布。
为了做到这一点,我确实知道有意图操作发送代码:
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("text/plain");
i.putExtra(Intent.EXTRA_SUBJECT, "Sharing URL");
i.putExtra(Intent.EXTRA_TEXT, "http://www.url.com");
startActivity(Intent.createChooser(i, "Share URL"));通过使用上述代码,所有其他社交应用程序都将显示在列表中,但在上面的代码中是否有方法只打开相应的社交应用程序,例如:只调用facebook。
or in order to perform share as i want must include facebook SDK to my app?比如:

发布于 2015-02-07 11:12:47
找到了答案,没有必要仅仅为了分享android应用程序的链接和文本而集成所有的社交媒体sdk。可以在Intent.ACTION_SEND的帮助下分享链接和文本这个链接http://kalisandroid.blogspot.in/2014/06/introduction-will-help-to-share-your.html帮助我为Facebook,LinkedIn,Twitter和Google加上下面的代码。
谷歌加代码:
googlePlus.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// share_image_text_GPLUS();
Intent shareIntent = ShareCompat.IntentBuilder
.from(getActivity())
.setText("http://link-you-wish-to-share-in-googleplus/")
.setType("text/plain").getIntent()
.setPackage("com.google.android.apps.plus");
startActivity(shareIntent);
}
});谢谢:)
发布于 2015-02-02 11:55:39
在Facebook-Sdk的帮助下,只要使用google教程,您就可以获得或转到https://developers.facebook.com/docs/android/share。
这可能会帮助你实现你想要实现的东西!
https://stackoverflow.com/questions/28276711
复制相似问题