void acctSelected(ServiceAcctInfo info) {
    Account acct = new Account();
    acct.name = info.desc;
    acct.service = info;

    DialogInterface.OnClickListener emptyClickListener =
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {}
        };

    AcctTables db = new AcctTables(this);
    try {
      db.openWritable();

      try {
        db.pushAccount(acct);
      } catch (SQLiteException e) {
        AlertDialog dlg =
            Utilities.buildAlert(
                this, e, "Unable to add account", "Internal Error", emptyClickListener);
        dlg.show();
        return;
      }
    } finally {
      db.close();
    }

    Intent i = getIntent();
    i.putExtra("acct_id", acct.ID);
    setResult(RESULT_OK, i);
    finish();
  }
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (requestCode == GET_SESSION) {
     if (resultCode == RESULT_CANCELED) {
       cancel();
     } else {
       int sessionId = data.getIntExtra("sess_id", 0);
       loadContext(sessionId);
     }
   }
 }
 void loginFailure() {
   Intent loginProf = new Intent(this, Login.class);
   loginProf.putExtra("prof_id", profileId);
   if (this.session != null) loginProf.putExtra("sess_id", this.session.ID);
   startActivityForResult(loginProf, GET_SESSION);
 }