简体   繁体   中英

Android twitter sdk using fabric Get public tweets of particular user

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM