I use the following code:
UserTimeline userTimeline = new UserTimeline.Builder().screenName("ZainAlabdin878").build();
final TweetTimelineListAdapter adapter = new TweetTimelineListAdapter(MainActivity.this, userTimeline);
System.out.println(adapter.getCount()+"");
I get the output 0 although I have tweets.
Am I doing something wrong? what I am trying to achieve is to get a list of tweets of a certain user. I'm using android studio and plugin.
*my goal is not to display the list but rather to get a List
many thanks.
final TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET);
Fabric.with(context, new Twitter(authConfig), new TweetUi());
TwitterCore.getInstance().logInGuest(new Callback<AppSession>() {
@Override
public void success(Result<AppSession> result) {
AppSession session = result.data;
TwitterApiClient twitterApiClient = TwitterCore.getInstance().getApiClient(session);
twitterApiClient.getStatusesService().userTimeline(tweetId, screenName, tweetCount, null, null, false, false, false, true, new Callback<List<Tweet>>() {
@Override
public void success(Result<List<Tweet>> listResult) {
for (Tweet tweet : listResult.data) {
// here you will get list
}
}
@Override
public void failure(TwitterException e) {
e.printStackTrace();
}
});
}
@Override
public void failure(TwitterException e) {
Log.e(TAG, "Load Tweet failure", e);
}
});
more details available here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With