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.
答案 0 :(得分:1)
UserTimeline
可以传递给TweetTimelineListAdapter
。 TweetTimelineListAdapter
可以在任何ListView上使用。
来自文档: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);
}
}
答案 1 :(得分:0)
你可以使用 http://docs.fabric.io/android/twitter/show-timelines.html#listactivity结构文档。所有你需要的是织物文档。但是如果你想使用你自己的适配器(自定义适配器),你可以使用这个github-gist-link。 https://gist.github.com/sabadow/a7dd2575325b676a113e