【问题标题】:Share Text + URL via WhatsApp通过 WhatsApp 分享文字 + 网址
【发布时间】:2014-12-19 14:19:35
【问题描述】:

我想通过 WhatsApp分享文字和网址

我查看了几个链接,但它只有共享文本功能。

如何分享 URL + 文字?

这是我迄今为止尝试过的。

Intent whatsappIntent = new Intent(Intent.ACTION_SEND);
whatsappIntent.setType("text/plain");
whatsappIntent.setPackage("com.whatsapp");
whatsappIntent.putExtra(Intent.EXTRA_TEXT, "The text you wanted to share");
try {
    activity.startActivity(whatsappIntent);
} catch (android.content.ActivityNotFoundException ex) {
    ToastHelper.MakeShortText("Whatsapp have not been installed.");
}

【问题讨论】:

    标签: android android-intent share whatsapp


    【解决方案1】:
    Intent sendIntent = new Intent();
                    sendIntent.setAction(Intent.ACTION_SEND);
                    sendIntent.putExtra(Intent.EXTRA_TEXT, "this my text https://www.google.co.in/webhp?ei=6cLkV8utKMnp0ASg5L7oAw&yv=2&rct=j");
                    sendIntent.setType("text/plain");
                    sendIntent.setPackage("com.whatsapp");
                    startActivity(sendIntent);
    

    【讨论】:

      【解决方案2】:

      我知道这已经很老了,但是将 url(作为文本)连接到文本对我来说很有效

      【讨论】:

        猜你喜欢
        • 2013-03-07
        • 1970-01-01
        • 2021-11-12
        • 1970-01-01
        • 1970-01-01
        • 2018-08-07
        • 2014-05-29
        • 2023-03-14
        相关资源
        最近更新 更多