Your Friends Seem Remote
catch (Throwable t) {
Log.e("Patchy", "Exception in call to registerAccount()", t);
goBlooey(t);
}
}
public void onServiceDisconnected(ComponentName className) {
service=null;
}
};
Then, in onDestroy(), wrap the removeAccount() in a try/catch block, to deal
with the possibility that our connection to the PostMonitor service has been
broken for some reason:
@Override
public void onDestroy() {
super.onDestroy();
try {
service.removeAccount(listener);
}
catch (Throwable t) {
Log.e("Patchy", "Exception in call to removeAccount()", t);
goBlooey(t);
}
unbindService(svcConn);
}
We also need to change resetClient() to wrap its service API calls in a
try/catch block, as follows:
synchronized private void resetClient() {
client=null;
try {
service.removeAccount(listener);
service.registerAccount(prefs.getString("user", ""),
prefs.getString("password", ""),
listener);
}
catch (Throwable t) {
Log.e("Patchy", "Exception in resetClient()", t);
goBlooey(t);
}
}