Android Cursor Put putToWindowHoneycombAndBeyond(Cursor cursor, int i, CursorWindow window, int position)

Here you can find the source of putToWindowHoneycombAndBeyond(Cursor cursor, int i, CursorWindow window, int position)

Description

put To Window Honeycomb And Beyond

License

Apache License

Declaration

private static boolean putToWindowHoneycombAndBeyond(Cursor cursor,
            int i, CursorWindow window, int position) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import android.database.Cursor;
import android.database.CursorWindow;

public class Main {
    private static boolean putToWindowHoneycombAndBeyond(Cursor cursor,
            int i, CursorWindow window, int position) {
        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);
            break;

        case Cursor.FIELD_TYPE_FLOAT:
            success = window.putDouble(cursor.getDouble(i), position, i);
            break;

        case Cursor.FIELD_TYPE_BLOB: {
            final byte[] value = cursor.getBlob(i);
            success = value != null ? window.putBlob(value, position, i)
                    : window.putNull(position, i);
            break;
        }//www  . ja  v a  2  s  .  c om

        default: // assume value is convertible to String
        case Cursor.FIELD_TYPE_STRING: {
            final String value = cursor.getString(i);
            success = value != null ? window.putString(value, position, i)
                    : window.putNull(position, i);
            break;
        }
        }

        return success;
    }
}

Related

  1. putToWindow(Cursor cursor, int column, CursorWindow window, int row)
  2. putToWindowPreHoneycomb(Cursor cursor, int i, CursorWindow window, int position)
  3. cursorFillWindow(final Cursor cursor, int position, final CursorWindow window)