How to update User Timeline with latest Tweets from Twitter?

android

#1

Hi,

I’m successful in showing User Timeline using Fabric, it’s pretty straight forward to implement. The code snippet followed.

UserTimeline userTimeline = new UserTimeline.Builder().userId(userId).build();
TweetTimelineListAdapter timelineAdapter = new TweetTimelineListAdapter(this, userTimeline);
setListAdapter(timelineAdapter); //Android ListView adapter

The above code implemented with Android Listview. Is there anyway to update user Timeline(ListView adapter) as it gets updated in Twitter? The requirement is,The app must update itself in the background so that posted tweets do show up automatically, even though they might be posted through the Twitter website
Any help would be appreciated.


#2

I’ve been trying that too for a couple of days now, but no success. I do know the TweetTimelineListAdapter has a refresh method. I sure that what we need, but not quit sure about it.


#3

Starting with TweetUi 1.2.0 (which comes with Twitter 1.5.0 and higher), TweetTimelineListAdapters include a refresh method which will delete the Tweets in the adapter and make a request for the latest Tweets. refresh(Callback<TimelineResult<T>> cb) takes a callback which you can use to handle the request’s success or failure. From the success callback, you get access to the latest Tweets loaded, though they’re automatically added to the adapter, you don’t need to take action on them.

If you’re interested in creating a “pull to refresh” style UI, we’ve included a small example in the sample app:


#4

Thank You very much.

Yes, refresh method helps update the Timeline from client.
Is there anyway app get notified if user tweeted from web console or other twitter client?
In other words, Can an Android app register for Twitter.com for particular user update?


#5