android - 如何开发分享按钮来分享链接?

标签 android share mime

例如我想分享这个链接:

http://www.orientaldaily.com.my/index.php?option=com_k2&view=item&id=6780:&Itemid=198

这是代码

private void shareIt() {
    Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
    sharingIntent.setType("text/plain");
    String shareBody = "Here is the share content body";
    sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
            "Subject Here");
    sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody);
    startActivity(Intent.createChooser(sharingIntent, "Share via"));
}

所以,

1) 如何让它分享到 facebook 的链接?

2) 如何编辑分享列表?

最佳答案

一旦您使用 createChooser() 将文本交给系统,它就不再由您掌控。

  1. 这取决于用户的选择,他们选择通过何种方式 (app/source) 共享。
  2. 您不能更改共享应用程序列表。 (由系统管理)

关于android - 如何开发分享按钮来分享链接?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10381677/

相关文章:

android - 如何在 Android 中的搜索输入字段旁边添加下拉菜单?

android - 如何重新连接到 google fit in android

java - 我应该将 token 安全地保存在内存或 sqlite 中吗?或者请建议

Android :This is not supported, 使用 MenuItemCompat.getActionProvider()

JavaScript:创建 MIME 消息

java - Android:ListView 中的 EditText 问题

android - 如何共享音频文件

Android - ES 文件资源管理器的共享 Intent

python - 将 zip 文件添加到电子邮件

linux - 如何在 Wanderlust 中查看备用 mime 内容