private void loadContext(int sessionId) { DialogInterface.OnClickListener dismissOnOk = new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { cancel(); } }; ProfileTable db = new ProfileTable(this); try { db.openReadable(); try { session = db.getSession(sessionId); } catch (SQLiteException e) { AlertDialog dlg = Utilities.buildAlert( this, e, "Unable to retrieve profile", "Internal Error", dismissOnOk); dlg.show(); return; } if (session == null) { AlertDialog dlg = Utilities.buildAlert( this, null, "Could not find login session", "Internal Error", dismissOnOk); dlg.show(); return; } try { accountList = db.getAccountsBySession(sessionId); } catch (SQLiteException e) { AlertDialog dlg = Utilities.buildAlert( this, e, "Unable to retrieve accounts", "Internal Error", dismissOnOk); dlg.show(); return; } } finally { db.close(); } if (accountList == null) { requestAccountList(); } else { buildView(); } }