Android Utililty Methods Cursor Put

List of utility methods to do Cursor Put

Description

The list of methods to do Cursor Put are organized into topic(s).

Method

booleanputToWindow(Cursor cursor, int column, CursorWindow window, int row)
This method was introduced by AndroidSQLiteServer to work around the lack of Cursor#getType(int) } on Gingerbread.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    return putToWindowHoneycombAndBeyond(cursor, column, window,
            row);
} else {
    return putToWindowPreHoneycomb(cursor, column, window, row);
booleanputToWindowHoneycombAndBeyond(Cursor cursor, int i, CursorWindow window, int position)
put To Window Honeycomb And Beyond
final int type = cursor.getType(i);
final boolean success;
switch (type) {
case Cursor.FIELD_TYPE_NULL:
    success = window.putNull(position, i);
    break;
case Cursor.FIELD_TYPE_INTEGER:
    success = window.putLong(cursor.getLong(i), position, i);
...
booleanputToWindowPreHoneycomb(Cursor cursor, int i, CursorWindow window, int position)
This solution is consistent with how Gingerbread implemented android.database.AbstractCursor#fillWindow(int,android.database.CursorWindow) .
String value = cursor.getString(i);
final boolean success;
if (value != null) {
    success = window.putString(value, position, i);
} else {
    success = window.putNull(position, i);
return success;
...
voidcursorFillWindow(final Cursor cursor, int position, final CursorWindow window)
Fills the specified cursor window by iterating over the contents of the cursor.
if (position < 0 || position >= cursor.getCount()) {
    return;
final int oldPos = cursor.getPosition();
final int numColumns = cursor.getColumnCount();
window.clear();
window.setStartPosition(position);
window.setNumColumns(numColumns);
...