private double getSummaryAccountsInternal(Context context) { double curTotal = 0; Core core = new Core(context); // compose whereClause String where = ""; // check if show only open accounts if (core.getAccountsOpenVisible()) { where = "LOWER(STATUS)='open'"; } // check if show fav accounts if (core.getAccountFavoriteVisible()) { where = "LOWER(FAVORITEACCT)='true'"; } QueryAccountBills accountBills = new QueryAccountBills(context); Cursor cursor = context.getContentResolver().query(accountBills.getUri(), null, where, null, null); if (cursor == null) return 0; // calculate summary while (cursor.moveToNext()) { curTotal = curTotal + cursor.getDouble(cursor.getColumnIndex(QueryAccountBills.TOTALBASECONVRATE)); } cursor.close(); return curTotal; }