get Boolean Value from Cursor - Android Database

Android examples for Database:Cursor Get

Description

get Boolean Value from Cursor

Demo Code


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

public class Main {
    public static boolean getBooleanValue(Cursor cursor, String columnName) {
        boolean value = false;

        final int columnIndex = cursor.getColumnIndex(columnName);
        if (columnIndex != -1) {
            final int rowValue = cursor.getInt(columnIndex);
            value = (rowValue != 0);/* w w w.  j ava 2s.  c o  m*/
        }

        return value;
    }
}

Related Tutorials