Reputation: 1293
I'm creating a Twitter app in Java and I need to check out if some particular tweet is in my favorites.
I read the doc, but did'nt find out what function does that kind of thing (hoping there is one).
Does somebody know ?
Thanks
Upvotes: 0
Views: 415
Reputation: 1293
Oh thanks ! I was looking for a method in the FavoritesResources, forgot to check out Status' methods for this one.
Thank you, have a good day !
Edit : Seems that this method returns if a tweet has been favorited in general, not by me in particular. Back to start :)
Upvotes: 0
Reputation: 1384
The Status
interface has the following method:
/**
* Test if the status is favorited
*
* @return true if favorited
* @since Twitter4J 1.0.4
*/
boolean isFavorited();
I made thw following example to show you how it works:
ResponseList<Status> result = twitter.getFavorites();
for (Status status : result)
{
System.out.println(status.getText());
System.out.println(status.isFavorited());
}
You can test also with ne following code:
QueryResult result = twitter.search(new Query("Some term"));
for (Status status : result.getTweets())
{
System.out.println(status.getText());
System.out.println(status.getFavoriteCount());
System.out.println(status.isFavorited());
}
And you are going to see that some tweets has n number of favoriteCount but it is going to return false because it is not of your favorites.
Upvotes: 2