Example usage for android.database Cursor close

List of usage examples for android.database Cursor close

Introduction

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

Prototype

void close();

Source Link

Document

Closes the Cursor, releasing all of its resources and making it completely invalid.

Usage

From source file:Main.java

public static void close(Cursor cursor) {
    if (cursor != null && !cursor.isClosed()) {
        cursor.close();
    }//from  w  w w. ja v  a2  s . c  o  m
}

From source file:Main.java

public static void closeCursor(Cursor cursor) {
    if (cursor != null && !cursor.isClosed()) {
        cursor.close();
    }//from  ww w.  jav a2  s  .c o m
    cursor = null;
}

From source file:Main.java

public static void closeCursor(Cursor... cursors) {
    if (cursors == null)
        return;//from w ww.j  a v  a2s. c  o  m
    for (Cursor cursor : cursors) {
        if (cursor != null) {
            cursor.close();
            cursor = null;
        }
    }
}

From source file:Main.java

public static void closeQuietly(Cursor cursor) {
    if (cursor != null) {
        try {//from w  w  w  .  ja  v  a  2  s  .  c om
            cursor.close();
        } catch (Throwable e) {
        }
    }
}

From source file:Main.java

public static void closeQuietly(Cursor cursor) {
    if (cursor != null) {
        cursor.close();
    }
}

From source file:Main.java

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

From source file:Main.java

public static void closeCursor(Cursor c) {
    try {//from w  w  w.j av  a  2  s .  c  o  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

/**
 * Close cursor if it's not <code>null</code>.
 *
 * @return <code>true</code> if closed, <code>false</code> if was <code>null</code>
 *///from   www .java2  s.c  o  m
public static boolean closeSafely(Cursor cursor) {
    if (cursor == null) {
        return false;
    } else {
        cursor.close();
        return true;
    }
}

From source file:Main.java

/***
 * Close cursor //from   ww w.  j  av  a  2 s. 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 boolean checkCursor(Cursor cur) {
    if (cur == null)
        return false;
    if (!cur.moveToFirst()) {
        cur.close();
        return false;
    }/* w ww .j a  v a2 s  . c o  m*/
    return true;
}