Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.database.Cursor;

public class Main {
    public static String getCursorString(Cursor cursor, String name) {
        if (isCursorEmpty(cursor)) {
            return "";
        } else {
            return cursor.getString(cursor.getColumnIndex(name));
        }
    }

    public static boolean isCursorEmpty(Cursor cursor) {
        return (cursor == null || cursor.isClosed() || cursor.getCount() == 0);
    }
}