How to tweet with multiple # tags in android?
I want to tweet on twitter using #tag.
for example
My text #tag you like # tag2 and my site.
This is my tweet text and when I call this data using the 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);
This is my code for post data, using Uri.when I post this data using intent, I only got this.
My text is #tag. My string gets cut off when I post to twitter.
+3
source to share
2 answers
I solve my problem after using this code replacing #, see below data for Uri format.
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"));
0
source to share