[英]Android - Get Twitter timeline using fabric
I'm working on an Android application, where I have to show an specific timeline. 我正在开发一个Android应用程序,必须在其中显示特定的时间表。 Well I have added fabric.io and I also created a twitter app(I mean I got the keys). 好吧,我添加了fabric.io,还创建了一个Twitter应用程序(我的意思是我得到了钥匙)。 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
. 因此,我该如何从userTimeline
获取这些推文。 Maybe I'm confuse and I'm implementing it wrong. 也许我感到困惑,并且我实施错误。
The UserTimeline
can be passed to the TweetTimelineListAdapter
. 可以将UserTimeline
传递给TweetTimelineListAdapter
。 The TweetTimelineListAdapter
can be used on any ListView. TweetTimelineListAdapter
可以在任何ListView上使用。
From the docs: http://docs.fabric.io/android/twitter/show-timelines.html#listactivity 从文档中: 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);
}
}
You can use http://docs.fabric.io/android/twitter/show-timelines.html#listactivity fabric documentation. 您可以使用http://docs.fabric.io/android/twitter/show-timelines.html#listactivity结构文档。 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. 但是,如果您想使用自己的适配器(自定义适配器),则可以使用此github-gist-link。 https://gist.github.com/sabadow/a7dd2575325b676a113e https://gist.github.com/sabadow/a7dd2575325b676a113e
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.