get Cursor String Value - Android Database

Android examples for Database:Cursor Get

Description

get Cursor String Value

Demo Code


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

public class Main {

    public static String getCursorStringValue(String ColumnName,
            Cursor cursor) {//from ww  w.  j  a v a  2  s  .c  om
        int col = cursor.getColumnIndex(ColumnName);

        if (col != -1 && !cursor.isNull(col)) {
            return cursor.getString(col);
        } else {
            return null;
        }
    }
}

Related Tutorials