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:com.getbase.android.db.loaders.ComposedCursorLoader.java

@Override
protected void onReset() {
    super.onReset();
    onStopLoading();/*from  w  w w.ja v a 2s. c  o m*/
    if (mResult != null) {
        Cursor cursor = cursorsForResults.get(mResult);
        if (cursor != null && !cursor.isClosed()) {
            cursor.close();
        }
        cursorsForResults.remove(mResult);
        mResult = null;
    }
}

From source file:com.granita.tasks.groupings.cursorloaders.CustomCursorLoader.java

@Override
public void deliverResult(Cursor cursor) {
    if (isReset()) {
        // An async query came in while the loader is stopped
        if (cursor != null && !cursor.isClosed()) {
            cursor.close();/*from ww  w  .  j  ava 2 s.  c  om*/
        }
        return;
    }
    Cursor oldCursor = mCursor;
    mCursor = cursor;

    if (isStarted()) {
        super.deliverResult(cursor);
    }

    if (oldCursor != null && oldCursor != cursor && !oldCursor.isClosed()) {
        oldCursor.close();
    }
}

From source file:org.fitchfamily.android.wifi_backend.ui.data.CursorLoader.java

@Override
public void onCanceled(Cursor cursor) {
    super.onCanceled(cursor);

    if (cursor != null && !cursor.isClosed()) {
        cursor.close();/*from   www .  j  a  v  a2  s .c om*/
    }
}

From source file:com.deange.textfaker.ui.activity.ConversationActivity.java

@Override
public void onLoadFinished(final Loader<Cursor> cursorLoader, final Cursor cursor) {
    if ((cursor != null) && (!cursor.isClosed())) {
        mAdapter.swapCursor(cursor);/*from  w  w  w .j a  v  a  2 s  .  c  o  m*/

        ViewUtils.setVisibility(findViewById(android.R.id.empty), cursor.getCount() == 0);
        ViewUtils.setVisibility(findViewById(android.R.id.list), cursor.getCount() != 0);
    }
}

From source file:fr.s13d.photobackup.media.PBMediaStore.java

private void closeCursor(Cursor cursor) {
    if (cursor != null && !cursor.isClosed()) {
        cursor.close();
    }
}

From source file:org.mariotaku.twidere.adapter.ComposeAutoCompleteAdapter.java

public void closeCursor() {
    final Cursor cursor = swapCursor(null);
    if (cursor == null)
        return;/*w w w  .j a  va2  s.c  o m*/
    if (!cursor.isClosed()) {
        cursor.close();
    }
}

From source file:com.getbase.android.db.loaders.ComposedCursorLoader.java

@Override
public void deliverResult(T data) {
    final Cursor cursor = cursorsForResults.get(data);
    if (isReset()) {
        // An async query came in while the loader is stopped
        if (cursor != null) {
            cursor.close();/*from  w w w  .jav  a  2 s .  co m*/
        }
        return;
    }
    T oldResult = mResult;
    mResult = data;

    if (isStarted()) {
        super.deliverResult(data);
    }

    if (oldResult != null) {
        Cursor oldCursor = cursorsForResults.get(oldResult);
        if (oldCursor != null && oldCursor != cursor && !oldCursor.isClosed()) {
            oldCursor.close();
        }
        cursorsForResults.remove(oldResult);
    }
}

From source file:eu.monniot.memoArcher.loaders.SimpleCursorLoader.java

@Override
public void deliverResult(Cursor cursor) {
    if (isReset()) {
        // An async query came in while the loader is stopped
        if (cursor != null)
            cursor.close();//from  w  w  w .j a v  a 2s. c o  m

        return;
    }

    Cursor oldCursor = mCursor;
    mCursor = cursor;

    if (isStarted())
        super.deliverResult(cursor);

    if (oldCursor != null && oldCursor != cursor && !oldCursor.isClosed())
        oldCursor.close();
}

From source file:com.aizak.drawnote.model.loader.SimpleCursorLoader.java

 @Override
public void deliverResult(Cursor cursor) {
   if (isReset()) {
      // An async query came in while the loader is stopped
      if (cursor != null) {
         cursor.close();// w  w  w  .ja v  a  2  s.c o  m
      }
      return;
   }
   Cursor oldCursor = mCursor;
   mCursor = cursor;

   if (isStarted()) {
      super.deliverResult(cursor);
   }

   if ((oldCursor != null) && (oldCursor != cursor) && !oldCursor.isClosed()) {
      oldCursor.close();
   }
}

From source file:nz.ac.otago.psyanlab.common.util.SimpleCursorLoader.java

@Override
public void deliverResult(Cursor cursor) {
    if (isReset()) {
        // An asynchronous query came in while the loader is stopped
        if (cursor != null) {
            cursor.close();//  w  w  w.j  av a  2 s  . co  m
        }
        return;
    }
    Cursor oldCursor = mCursor;
    mCursor = cursor;

    if (isStarted()) {
        super.deliverResult(cursor);
    }

    if (oldCursor != null && oldCursor != cursor && !oldCursor.isClosed()) {
        oldCursor.close();
    }
}