Example usage for android.database CursorWindow isBlob

List of usage examples for android.database CursorWindow isBlob

Introduction

In this page you can find the example usage for android.database CursorWindow isBlob.

Prototype

@Deprecated
public boolean isBlob(int row, int column) 

Source Link

Document

Returns true if the field at the specified row and column index has type Cursor#FIELD_TYPE_BLOB or Cursor#FIELD_TYPE_NULL .

Usage

From source file:Main.java

private static int getType(Cursor cursor, int columnIndex) throws Exception {

    if (Build.VERSION.SDK_INT >= 11) {
        return cursor.getType(columnIndex);
    }/*from  w ww . j a  va2s  . c om*/

    SQLiteCursor sqLiteCursor = (SQLiteCursor) cursor;
    CursorWindow cursorWindow = sqLiteCursor.getWindow();
    int pos = cursor.getPosition();
    int type = -1;
    if (cursorWindow.isNull(pos, columnIndex)) {
        type = Cursor.FIELD_TYPE_NULL;
    } else if (cursorWindow.isLong(pos, columnIndex)) {
        type = Cursor.FIELD_TYPE_INTEGER;
    } else if (cursorWindow.isFloat(pos, columnIndex)) {
        type = Cursor.FIELD_TYPE_FLOAT;
    } else if (cursorWindow.isString(pos, columnIndex)) {
        type = Cursor.FIELD_TYPE_STRING;
    } else if (cursorWindow.isBlob(pos, columnIndex)) {
        type = Cursor.FIELD_TYPE_BLOB;
    }

    return type;
}