No, Really Listening To Your Friends
Button send=(Button)findViewById(R.id.send);
send.setOnClickListener(onSend);
prefs=PreferenceManager.getDefaultSharedPreferences(this);
prefs.registerOnSharedPreferenceChangeListener(prefListener);
bindService(new Intent(this, PostMonitor.class), svcConn,
BIND_AUTO_CREATE);
adapter=new TimelineAdapter();
((ListView)findViewById(R.id.timeline)).setAdapter(adapter);
}
Finally, add logic to our listener object to create a TimelineEntry and add it
to the top of the TimelineAdapter, so new entries are added to the head of
the list:
private IPostListener listener=new IPostListener() {
public void newFriendStatus(final String friend, final String status,
final String createdAt) {
runOnUiThread(new Runnable() {
public void run() {
adapter.insert(new TimelineEntry(friend,
createdAt,
status),
0 );
}
});
}
};
With all that behind you, recompile and reinstall the application. Now,
Patchy will display your timeline and should keep the timeline current as
new entries roll in: