gon250
gon250

Reputation: 3545

Android - Get Twitter timeline using fabric

I'm working on an Android application, where I have to show an specific timeline. Well I have added fabric.io and I also created a twitter app(I mean I got the keys). So I really don't know how can I get the twitts on my class to display them on my listview. let see the code below:

TwitterAuthConfig authConf =
                new TwitterAuthConfig(this.getResources().getString(R.string.consumerKey),
                        this.getResources().getString(R.string.consumerSecret));
        Fabric.with(this, new Twitter(authConfig));

final UserTimeline userTimeline = new UserTimeline.Builder()
                .screenName("TwitterUser")
                .build();

So, how can I grab the tweets from the userTimeline. Maybe I'm confuse and I'm implementing it wrong.

Upvotes: 0

Views: 1122

Answers (2)

Tarık Eren Tan
Tarık Eren Tan

Reputation: 23

You can use http://docs.fabric.io/android/twitter/show-timelines.html#listactivity fabric documentation. All of you need is found fabric documentation. But if you want use your own adapter (custom adapter) you can use this github-gist-link. https://gist.github.com/sabadow/a7dd2575325b676a113e

Upvotes: 0

Frohnzie
Frohnzie

Reputation: 3569

The UserTimeline can be passed to the TweetTimelineListAdapter. The TweetTimelineListAdapter can be used on any ListView.

From the docs: http://docs.fabric.io/android/twitter/show-timelines.html#listactivity

import com.twitter.sdk.android.tweetui.TweetTimelineListAdapter;
import com.twitter.sdk.android.tweetui.UserTimeline;

public class TimelineActivity extends ListActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.timeline);

        final UserTimeline userTimeline = new UserTimeline.Builder()
            .screenName("fabric")
            .build();
        final TweetTimelineListAdapter adapter = new TweetTimelineListAdapter(this, userTimeline);
        setListAdapter(adapter);
    }
}

Upvotes: 1

Related Questions