android - 如何使用默认的 android 共享( Intent )将文本共享到 facebook?

标签 android facebook android-intent

我正在努力在所有默认可用的应用程序中进行文本共享,例如 facebook、gmail 等。

我在这里放了我的代码的快照。

final Intent emailIntent1 = new Intent(
            android.content.Intent.ACTION_SEND);
    emailIntent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    emailIntent1.setAction("https://play.google.com/store");
    emailIntent1.putExtra(Intent.EXTRA_TEXT,"https://play.google.com/store");
    emailIntent1.setType("image/png");
    startActivity(Intent.createChooser(emailIntent1, "send"));

我的问题是,我无法在 facebook 中分享文本。

非常感谢您的回答。

最佳答案

试试这个...

 Intent shareIntent = new Intent(Intent.ACTION_SEND);
        shareIntent.setType("text/plain");
        shareIntent.putExtra(Intent.EXTRA_SUBJECT, "Share this app");
        String shareMessage = "https://play.google.com/store";
        shareIntent.putExtra(Intent.EXTRA_TEXT, shareMessage);
        startActivity(Intent.createChooser(shareIntent, "Choose the messenger to share this App"));

关于android - 如何使用默认的 android 共享( Intent )将文本共享到 facebook?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35126326/

相关文章:

android - 停止 Android Activity ,使用 noHistory ="true"

与版本 1.0 兼容的客户端 Socket.io 的 Java 实现

ios - Facebook SDK : app not registered as a URL Scheme

facebook - Azure 移动 : Client-directed login operation error (Facebook)

android - 如何在应用程序运行时持续检查互联网连接

通知点击的Android调用方法

java - 如何将 Java 构造函数正确翻译为 Kotlin?

android - Gradle 同步失败 : Could not find com. android.tools.build :gradle:3. 0.1

java - 使用 FQL 删除 Facebook 帖子

android - 待定 Intent 似乎没有通过附加功能