关于我们页面与 facebook,google 加上图标

About us page with facebook,google plus icons

在我正在开发的应用程序中,有 4 个社交网络应用程序按钮图标,如 Facebook、Twitter、linkedIn 和关于我们页面的 Google+。现在单击我需要 post url 的那些按钮并在相应的社交网络应用程序中发送文本。

即:当我点击 facebook 按钮 URL 和文本(我们的目标是......)必须 post 在 facebook 中编辑。

为了做到这一点,我知道有 Intent 操作发送代码:

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?

喜欢:

在 Facebook-Sdk 的帮助下是可能的,只需 google 个教程,您将获得或以其他方式转到 https://developers.facebook.com/docs/android/share

这可能对您要实现的目标有所帮助!

找到答案,没有必要集成每个社交媒体 sdk 只是为了分享 link 和来自 android 应用程序的文本。可以在 Intent.ACTION_SEND 的帮助下分享 link 和文本 link<http://kalisandroid.blogspot.in/2014/06/introduction-will-help-to-share-your.html> 帮助我在 Facebook、LinkedIn、Twitter 和 Google 加上下面是代码。

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);
            }
        });

谢谢:)