简体   繁体   中英

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.

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..

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

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

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