How to post hyperlink text in twitter using twitter4j in android

只愿长相守 提交于 2019-12-11 17:40:50

问题


I want to post a text on twitter which will hyperlink with one Url. is this Possible? any way to implement this.I read some blog and posts that this is not supported by Twitter. There is any alternate to implement this one in my android application.

M using Twitter4J . Code is below.

String verifier = uri.getQueryParameter("oauth_verifier");
AccessToken accessToken = twitter.getOAuthAccessToken(requestToken, verifier);
String token = accessToken.getToken(), secret = accessToken.getTokenSecret();
twitter.setOAuthAccessToken(token, secret);
StatusUpdate status = new StatusUpdate("Listening"+"<a href "+base_link_url+"</a>");
//status.setMedia(file);
twitter.updateStatus(status);               

This is posting hyperlink as text. Kindly suggest me on that issue.


回答1:


You have not to do any thing.Twitter automaticaly recognize your link(URL) Do this

 StatusUpdate status = new StatusUpdate("Listening  "+"https://www.google.co.in/");


来源:https://stackoverflow.com/questions/13227281/how-to-post-hyperlink-text-in-twitter-using-twitter4j-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!