Android twitter sdk using fabric Get public tweets of particular user

谁说胖子不能爱 提交于 2019-12-11 11:13:06

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!