gpt4 book ai didi

Android:与内置应用程序共享时无法获得正确的文本

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:46:57 25 4
gpt4 key购买 nike

我使用了以下代码。

 Intent share = new Intent(android.content.Intent.ACTION_SEND);
share.setType("text/plain");
share.putExtra(Intent.EXTRA_SUBJECT, subject);
share.putExtra(
Intent.EXTRA_TEXT,
"i have just visited http://www.google.com");
startActivity(Intent.createChooser(share,
"Share Sydneyho! with your friends via"));

当我选择 gmail 时,它显示了 Intent.EXTRA_TEXT 中的内容,但是当我选择 facebook 时,它显示了完全不同的消息,我不知道不知道它是从哪里来的。

请帮忙!

最佳答案

我已使用以下代码 fragment 通过 Action_Send 将 Message 分享给其他应用。

Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
sharingIntent.putExtra("android.intent.extra.SUBJECT", "");
sharingIntent.putExtra("android.intent.extra.TEXT", "ABC");
startActivity(Intent.createChooser(sharingIntent, "Share using"));

它在我的设备(Android 2.2)中运行良好。从概念上讲,我不知道您的代码和上面的代码有什么不同。但是上面的代码对我来说工作正常。

关于Android:与内置应用程序共享时无法获得正确的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9277283/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com