Example usage for android.database Cursor isClosed

List of usage examples for android.database Cursor isClosed

Introduction

In this page you can find the example usage for android.database Cursor isClosed.

Prototype

boolean isClosed();

Source Link

Document

return true if the cursor is closed

Usage

From source file:Main.java

public static void closeCursor(Cursor c) {
    if (c != null && !c.isClosed()) {
        c.close();
    }
}

From source file:Main.java

public static void close(Cursor cursor) {
    if (cursor != null && !cursor.isClosed()) {
        cursor.close();/*  w ww  . j a  va 2s  . c om*/
    }
}

From source file:Main.java

public static void closeCursor(Cursor cursor) {
    if (cursor != null && !cursor.isClosed()) {
        cursor.close();/*  w w  w  . j  ava  2s. c o m*/
    }
    cursor = null;
}

From source file:Main.java

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

From source file:Main.java

/**
 * Checks if the passed {@link Cursor} is not null and is open.
 * @param cursor The {@link Cursor} to check.
 * @return <code>true</code> if {@link Cursor} is open, <code>false</code> if
 * it is closed./*from ww  w. j a va 2  s. c om*/
 */
public static boolean isOpen(final Cursor cursor) {
    return (cursor != null) && (!cursor.isClosed());
}

From source file:Main.java

/***
 * Close cursor /*w  w w. jav  a  2s.  c o m*/
 * @param cursor
 */
public static void closeCursor(Cursor cursor) {
    if (cursor != null && !cursor.isClosed()) {
        try {
            cursor.close();
        } catch (Exception e) {
            //Do Nothing
            e.printStackTrace();
        }
    }
}

From source file:Main.java

public static void closeCursor(Cursor c) {
    try {/*from   www .  ja v  a  2  s.  co  m*/
        if (c != null && c.isClosed() != true) {
            c.close();
            c = null;
        }
    } catch (Exception e) {
        Log.e("xs", "SingleBook onDestroy:" + e.toString());
    }
}

From source file:Main.java

public static void closeCursor(Cursor cursor) {
    if (null != cursor) {
        if (!cursor.isClosed()) {
            cursor.close();//from   ww w .j  av  a 2 s . c  o  m
        }
    }
}

From source file:Main.java

public static void closeSafely(Cursor cursor) {
    try {//from  www. java 2s .c o m
        if (cursor != null && !cursor.isClosed()) {
            cursor.close();
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Main.java

/**
 * Tries to find out if the given cursor points to a dataset with unread articles in it, returns true if it does.
 *
 * @param cursor the cursor.//from w  w  w  .  j a va 2  s .com
 * @return true if there are unread articles in the dataset, else false.
 */
private static boolean checkUnread(Cursor cursor) {
    if (cursor == null || cursor.isClosed())
        return false; // Check null or closed

    if (!cursor.moveToFirst())
        return false; // Check empty

    do {
        if (cursor.getInt(cursor.getColumnIndex("unread")) > 0)
            return cursor.moveToFirst(); // One unread article found, move to first entry
    } while (cursor.moveToNext());

    cursor.moveToFirst();
    return false;
}