【问题标题】:How to share information links on twitter, gmail, facebook etc如何在 twitter、gmail、facebook 等上分享信息链接
【发布时间】:2011-04-15 12:12:29
【问题描述】:

我正在实现一个新闻应用程序。我需要在 gmail、twitter 或 facebook 等上实现共享新闻链接。我该怎么做?

【问题讨论】:

标签: android


【解决方案1】:

您可以将 Intent 与 Action SEND 一起使用来分享某些内容。 Android 将在手机上寻找能够接收此 Intent 的每个应用程序,并向用户显示一个对话框以从应用程序中进行选择。这样,用户只能获得他使用的服务。如果他使用 Twitter 客户端,客户端将对发送意图作出反应,邮件应用程序也会对其作出反应,Facebook 应用程序也会出现使用这个特殊的网络来分享你的新闻。为此,您只需要执行以下操作:

Intent share = new Intent(android.content.Intent.ACTION_SEND);
share.setType("text/plain");
share.putExtra(Intent.EXTRA_SUBJECT, "Name of the thing to share");
share.putExtra(Intent.EXTRA_TEXT, getText("Text that will be shared");
startActivity(Intent.createChooser(share, "Title of the dialog that will show up"));

有关更多信息,请查看 Konstantin 提供的链接

【讨论】:

    【解决方案2】:

    看看hereherehere。看来您需要 ACTION_SEND 意图。

    【讨论】:

    • 感谢您的支持,burov.. 我浏览了链接
    猜你喜欢
    • 1970-01-01
    • 2011-11-10
    • 2013-10-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-05
    • 2012-05-25
    相关资源
    最近更新 更多