0

我现在计划在手机中分享一些文本和链接到 SNS 应用程序。我使用的代码如下:

    Intent shareIntent = new Intent();
    shareIntent.setAction(Intent.ACTION_SEND);
    shareIntent.putExtra(Intent.EXTRA_TEXT, "the word i like to say");
    shareIntent.setType("text/plain");
    this.startActivity(Intent.createChooser(shareIntent, "share with below apps"));
    return shareIntent;

有很多选择,但不幸的是没有微信朋友圈。当然我可以使用 shareSDK 来实现,但后者没有 Facebook/LinkedIn/Google+。并且包含了太多我不喜欢的第三个库。更重要的是,在两个单独的菜单中显示共享选项是相当连贯的。

那么,有没有一种方法可以将“微信朋友圈”选项添加到之前的实现中(如下图所示)?这将非常有帮助。

发送到添加到选项中的时刻

4

1 回答 1

1

微信只接受图片。下面将起作用。

Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(File obj));
shareIntent.setType("image/jpeg");
this.startActivity(Intent.createChooser(shareIntent, "share with below apps"));
return shareIntent;
于 2015-10-15T10:09:18.917 回答