Reputation: 294
i am developing and application in which i want to get some feeds from twitter like picture, name, tweets, time and number of reply on each tweet. i did all but could not get number of reply for each tweet.... help me out thanks in advance.. i am posting my code also.
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);
Upvotes: 0
Views: 224
Reputation: 356
Try this snippet of code... it worked for me.. hope for you too
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());
}
Upvotes: 1
Reputation: 21
try getRelatedResults(),gives a list of replies + mentions,it is the closest to getting replies.
Upvotes: 0