public static void cursorStringToContentValuesIfPresent(Cursor paramCursor, ContentValues paramContentValues, String paramString) { int i = paramCursor.getColumnIndex(paramString); if ((i != -1) && (!paramCursor.isNull(i))) { paramContentValues.put(paramString, paramCursor.getString(i)); } }
/** * Reads a Double out of a field in a Cursor and writes it to a Map. * * @param cursor The cursor to read from * @param field The REAL field to read * @param values The {@link ContentValues} to put the value into * @param key The key to store the value with in the map */ public static void cursorDoubleToContentValues( Cursor cursor, String field, ContentValues values, String key) { int colIndex = cursor.getColumnIndex(field); if (!cursor.isNull(colIndex)) { values.put(key, cursor.getDouble(colIndex)); } else { values.put(key, (Double) null); } }
public static void cursorLongToContentValues(Cursor paramCursor, String paramString1, ContentValues paramContentValues, String paramString2) { int i = paramCursor.getColumnIndex(paramString1); if (!paramCursor.isNull(i)) { paramContentValues.put(paramString2, Long.valueOf(paramCursor.getLong(i))); return; } paramContentValues.put(paramString2, null); }
/** * Reads a Long out of a field in a Cursor and writes it to a Map. * * @param cursor The cursor to read from * @param field The INTEGER field to read * @param values The {@link ContentValues} to put the value into * @param key The key to store the value with in the map */ public static void cursorLongToContentValues( Cursor cursor, String field, ContentValues values, String key) { int colIndex = cursor.getColumnIndex(field); if (!cursor.isNull(colIndex)) { Long value = Long.valueOf(cursor.getLong(colIndex)); values.put(key, value); } else { values.put(key, (Long) null); } }