简体   繁体   English

使用Fabric / Twitter套件获取经过身份验证的用户的Twitter Feed-Android

[英]Get Authenticated User's Twitter Feed Using Fabric/Twitter Kit - Android

I've set up Fabric and a log in button in Android Studio using the guide from the docs and now want to fetch the logged in user's twitter feed such as on the official app. 我已经使用文档中的指南在Android Studio中设置了Fabric和一个登录按钮,现在想获取登录用户的Twitter feed,例如在官方应用程序上。

How do I implement this? 我该如何实施? The official docs mention using the REST API but don't show a way to add the homeTimeline to a GridView/ListView adapter.. 官方文档提到使用REST API,但没有显示将homeTimeline添加到GridView / ListView适配器的方法。

Even is an old question and hopefully you've found the solution, i post the answer as i think the Fabric Twitter Android Documentation i's a ____ Maybe this method i use can help you 甚至是一个老问题,希望您已经找到了解决方案,我发布了答案,因为我认为Fabric Twitter Android文档我是____也许我使用的这种方法可以为您提供帮助

public void getTweets(){
    TwitterApiClient twitterApiClient = TwitterCore.getInstance().getApiClient();
    twitterApiClient.getStatusesService().homeTimeline(null, null, null, null,null,null, null, new Callback <List<Tweet>>() {

        @Override
        public void success(Result<List<Tweet>> listResult) {
            tweets = listResult.data;
            final FixedTweetTimeline userTimeline = new FixedTweetTimeline.Builder()
                    .setTweets(tweets)
                    .build();
            adapter = new CustomTweetTimelineListAdapter(TimelineActivity.this, userTimeline);
            setListAdapter(adapter);
        }

        @Override
        public void failure(TwitterException e) {
            Log.d("Twitter","twitter " + e );
        }
    });
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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