public int saveExchangeRate(int currencyId, Money exchangeRate) { ContentValues contentValues = new ContentValues(); contentValues.put(TableCurrencyFormats.BASECONVRATE, exchangeRate.toString()); int result = mContext .getContentResolver() .update( mCurrencyTable.getUri(), contentValues, TableCurrencyFormats.CURRENCYID + "=?", new String[] {Integer.toString(currencyId)}); return result; }
private TableCurrencyFormats loadCurrencyInternal(String selection, String[] selectionArgs) { TableCurrencyFormats currency = mCurrencyTable; Cursor cursor = mContext .getContentResolver() .query(currency.getUri(), currency.getAllColumns(), selection, selectionArgs, null); if (cursor == null) return null; if (cursor.moveToNext()) { currency.setValueFromCursor(cursor); } else { currency = null; } cursor.close(); return currency; }