Your Friends Seem Remote
try {
l.callback.newFriendStatus(s.user.screenName, s.text,
s.createdAt.toString());
seenStatus.add(s.id);
}
catch (Throwable t) {
Log.e("PostMonitor", "Exception in callback", t);
}
}
}
}
catch (Throwable t) {
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);
pollPeriod=POLL_PERIOD;
}
SystemClock.sleep(pollPeriod);
}
}
};
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;
}
}
private final IPostMonitor.Stub binder=new IPostMonitor.Stub() {
public void registerAccount(String user, String password,
IPostListener callback) {
Account l=new Account(user, password, callback);
poll(l);
accounts.put(callback, l);
}
public void removeAccount(IPostListener callback) {
accounts.remove(callback);
}