android - 如何在 android 中使用多个 # 标签发推文?

标签 android twitter

我想在 Twitter 上使用 # 标签发推文。

例如

我的文字#tag you like it #tag2 和我的网站。

这是我的推文文本,当我使用 Uri 调用此数据时。

String finalTweet = "https://twitter.com/intent/tweet?source=webclient&text=" + "&hashtags=" + Name
                    + " Im Share &hashtags=" + Title
                    + " @text – link to "
                    + someURL;
mIntent.setData(Uri.parse(finalTweet));
startActivity(mIntent);

这是我使用 Uri 发布数据的代码。当我通过 Intent 发布这些数据时,我只得到了这个。

我的文字#tag。 当我在推特上发帖时,我的弦断了。

最佳答案

在使用此代码替换 # 请参阅下面的 Uri 格式数据后,我解决了我的问题。

url = new String(url.trim().replace(" ", "%20").replace("&", "%26")
.replace(",", "%2c").replace("(", "%28").replace(")", "%29")
.replace("!", "%21").replace("=", "%3D").replace("<", "%3C")
.replace(">", "%3E").replace("#", "%23").replace("$", "%24")
.replace("'", "%27").replace("*", "%2A").replace("-", "%2D")
.replace(".", "%2E").replace("/", "%2F").replace(":", "%3A")
.replace(";", "%3B").replace("?", "%3F").replace("@", "%40")
.replace("[", "%5B").replace("\\", "%5C").replace("]", "%5D")
.replace("_", "%5F").replace("`", "%60").replace("{", "%7B")
.replace("|", "%7C").replace("}", "%7D"));

关于android - 如何在 android 中使用多个 # 标签发推文?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26100327/

相关文章:

php - 如何检索我发推最多的词?

iphone - 在 IOS-5 中获取 twitter 帐户列表并使用 TWTweetComposeViewController 使用它

android - Firebase 通知不显示使用 PHP

c# - Xamarin 应用程序 Release模式下的 NullReferenceException

Wordpress:自动从推文和 YouTube 视频创建博客文章?

javascript - 如何在 css 中定位自动生成的列表

twitter - 尝试发布时从 Twitter 获取 "Could not authenticate with OAuth."

java - 将播放服务更新到 8.3.0 后无法创建发布版本

android - Android 中对 'cv::initModule_nonfree()' 的 undefined reference

Android Retrofit 动态端点 URL