问题
Hello Guys I am facing a small trouble while working on twitter integration. I have used Fabric .
private void loadTweet(){
final List<Long> tweetIds = Arrays.asList(510908133917487104L);
TweetUtils.loadTweets(tweetIds, new Callback<List<Tweet>>() {
@Override
public void success(Result<List<Tweet>> result) {
for (Tweet tweet : result.data) {
tweeterLayout.setTweet(tweet);
}
}
@Override
public void failure(TwitterException e) {
Log.v("Exception","TwitterException");
}
});
}
This method works fine for me if I pass a tweet ID. But I want to get public tweets of a particular user. any way around if I pass someone's ID ("@user_id") then I can fetch his tweets?
回答1:
Yes, you can retrieve a user's timeline.
String twitter_account = "jack";
final UserTimeline userTimeline = new UserTimeline.Builder()
.screenName(twitter_account)
.build();
final TweetTimelineListAdapter adapter = new TweetTimelineListAdapter.Builder(getActivity())
.setTimeline(userTimeline)
.build();
setListAdapter(adapter);
来源:https://stackoverflow.com/questions/35994186/android-twitter-sdk-using-fabric-get-public-tweets-of-particular-user