【问题标题】:how to develop a share button to share a link?如何开发分享按钮来分享链接?
【发布时间】:2012-05-10 00:49:21
【问题描述】:

例如我想分享这个链接:

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) 如何编辑分享列表?

【问题讨论】:

    标签: android share mime


    【解决方案1】:

    一旦您使用createChooser() 将文本交给系统,它就无法控制。

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

    【讨论】:

    • 晕@Adil Soomro,可以指导我吗?我应该把 createChooser() 放在哪里
    • 我没听懂你。你应该把选择器放在哪里取决于你,你想在哪里共享数据..
    • 例如这样? sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, "http://www.orientaldaily.com.my/index.php?option=com_k2&view=item&id=6780:&Itemid=198");这是正确的吗?
    • 是的,当然。它是一个有效的字符串,将在那里发布。
    • 我刚刚成功。谢谢
    猜你喜欢
    • 2023-02-08
    • 1970-01-01
    • 2013-11-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多