我在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);