【问题标题】:android twitter安卓推特
【发布时间】:2012-06-18 16:01:36
【问题描述】:

我正在开发和应用程序,我想从 Twitter 获取一些提要,例如图片、名称、推文、时间和每条推文的回复次数。我做了所有但无法获得每条推文的回复数量..帮我提前谢谢.. 我也在发布我的代码。

Twitter unauthenticatedTwitter = new TwitterFactory().getInstance();
                 Paging paging = new Paging(1, 100);
                 List<twitter4j.Status> statuses = unauthenticatedTwitter.getUserTimeline("BeingSalmanKhan",paging);

                         for (Status status3 : statuses) 
                          {
                             TwitterFeeds tFeeds = new TwitterFeeds();
                                 System.out.println(status3.getText());
                                 tFeeds.strTweet = status3.getText();
                                 tFeeds.strDate  = status3.getCreatedAt().toString();
                                 System.out.println("---------------------------------- " + status3.getSource());

                                 al_tweets.add(tFeeds);

                          }
                         str_tw_name    =   unauthenticatedTwitter.showUser("BeingSalmanKhan").getName();
                         str_tw_imgurl  =   unauthenticatedTwitter.showUser("BeingSalmanKhan").getProfileImageURL().toString();



                         bitmap_twpic = NewsActivity.DownloadImage(str_tw_imgurl);

【问题讨论】:

    标签: android twitter


    【解决方案1】:

    试试这个sn-p代码...它对我有用..希望对你也有用

    try {
                       Twitter unauthenticatedTwitter = new TwitterFactory().getInstance();
                       //URLEntity[] uent= 
                     //First param of Paging() is the page number, second is the number per page (this is capped around 200 I think.
                     Paging paging = new Paging(1, 100);
                     List<twitter4j.Status> statuses = unauthenticatedTwitter.getUserTimeline("ashabhosle",paging);
                     System.out.println("status no 2 ="+statuses.get(2).toString());
                     long retweetcnt=statuses.get(2).getRetweetCount();
                     System.out.println("retweet count on 2nd tweet "+retweetcnt);
                             for (Status status3 : statuses) 
                              {
                                     System.out.println(status3.getText());
                              }
                } 
                   catch (Exception e) {
                    e.printStackTrace();
                    System.out.println("Failed to get timeline: " + e.getMessage());
    
                }
    

    【讨论】:

      【解决方案2】:

      尝试getRelatedResults(),给出回复+提及的列表,它最接近获得回复。

      【讨论】:

      • 它需要很长的参数,我有一个字符串的屏幕名称......请告诉我如何使用这个方法......
      猜你喜欢
      • 2011-04-14
      • 2012-10-09
      • 2011-07-01
      • 1970-01-01
      • 2013-06-24
      • 1970-01-01
      • 1970-01-01
      • 2021-12-10
      • 2017-12-01
      相关资源
      最近更新 更多