我在twitter上工作,我有访问令牌,我现在也收到推文我想在推特上回复,就像我们在Twitter网站上做的那样我使用下面的代码,但它不是回复推文但它更新我的状态请帮我解决这个问题谢谢..
public void tweetReply() { try { // System.out.println("Post Id= " + itemsObj.postId); AccessToken a = new AccessToken(twittertokens[0],twittertokens[1]); Twitter twitter = new TwitterFactory().getInstance(); twitter = new TwitterFactory().getInstance(); twitter.setOAuthConsumer(Constants.CONSUMER_KEY,Constants.CONSUMER_SECRET); twitter.setOAuthAccessToken(a); Long id = new Long("236178766597087234"); twitter.updateStatus(new StatusUpdate("@lalitrajput024 this is to test For reply option ").inReplyToStatusId(id)); } catch (Exception e) { // TODO: handle exception } }
解决方法
我也遇到了这个问题,然后我尝试在文本中使用处理程序.现在它似乎正在工作.
public static void reply(long inReplyToStatusId,String text,double latitude,double longitude,TwitterFactory factory) throws TwitterException { AccessToken accessToken = loadAccessToken(); Twitter twitter = factory.getInstance(); twitter.setOAuthConsumer(consumerKey,consumerSecrate); twitter.setOAuthAccessToken(accessToken); StatusUpdate stat= new StatusUpdate(text); stat.setInReplyToStatusId(inReplyToStatusId); GeoLocation location= new GeoLocation(latitude,longitude); stat.setLocation(location); twitter.updateStatus(stat); }'
我称之为
reply(238912922250792960l,"@praveena_kd testing reply",12.787,77.7578,factory);