get Cursor Integer Value - Android Database

Android examples for Database:Cursor Get

Description

get Cursor Integer Value

Demo Code


//package com.java2s;
import android.database.Cursor;

public class Main {

    public static int getCursorIntegerValue(String ColumnName, Cursor cursor) {
        int col = cursor.getColumnIndex(ColumnName);
        if (col != -1 && !cursor.isNull(col)) {
            return cursor.getInt(col);
        } else {/*from   w  w w .j av a2s  . c  o  m*/
            return -1;
        }
    }
}

Related Tutorials