No, Really Listening To Your Friends
active.set(false);
}
private void poll(Account l) {
try {
Twitter client=new Twitter(l.user, l.password);
client.setAPIRootUrl("https://identi.ca/api");
List<Twitter.Status> timeline=client.getFriendsTimeline();
for (Twitter.Status s : timeline) {
if (!seenStatus.contains(s.id)) {
l.callback.newFriendStatus(s.user.screenName, s.text,
s.createdAt.toString());
seenStatus.add(s.id);
}
}
}
catch (Throwable t) {
android.util.Log.e("PostMonitor",
"Exception in poll()", t);
}
}
private Runnable threadBody=new Runnable() {
public void run() {
while (active.get()) {
for (Account l : accounts.values()) {
poll(l);
}
SystemClock.sleep(POLL_PERIOD);
}
}
};
class Account {
String user=null;
String password=null;
IPostListener callback=null;
Account(String user, String password,
IPostListener callback) {
this.user=user;
this.password=password;
this.callback=callback;
}
}
public class LocalBinder extends Binder implements IPostMonitor {
public void registerAccount(String user, String password,
IPostListener callback) {