List of usage examples for android.database Cursor isClosed
boolean isClosed();
From source file:com.commonsware.cwac.loaderex.AbstractCursorLoader.java
/** * Must be called from the UI thread, triggered by a * call to cancel(). Here, we make sure our Cursor * is closed, if it still exists and is not already closed. *///from w w w . j av a 2s . c om @Override public void onCanceled(Cursor cursor) { if (cursor != null && !cursor.isClosed()) { cursor.close(); } }
From source file:mobisocial.omnistanford.db.SimpleCursorLoader.java
@Override public void onCanceled(Cursor cursor) { Log.d(TAG, "onCanceled"); if (cursor != null && !cursor.isClosed()) { cursor.close();/*from w w w.j a v a 2 s .co m*/ } }
From source file:com.jiahaoliuliu.storyteller.utils.SimpleCursorLoader.java
/** * Helper method to take care of releasing resources. *//*from w ww . ja v a 2 s . c om*/ private void releaseResource(Cursor cursor) { if (cursor != null && cursor.isClosed()) { cursor.close(); } }
From source file:org.opendatakit.common.android.database.IdInstanceNameStruct.java
/** * Accessor to retrieve the database tableId given a formId * * @param db/*from ww w .j a va2s . c om*/ * @param formId * -- either the integer _ID or the textual form_id * @return */ public static IdInstanceNameStruct getIds(SQLiteDatabase db, String formId) { boolean isNumericId = StringUtils.isNumeric(formId); Cursor c = null; try { c = db.query(DatabaseConstants.FORMS_TABLE_NAME, new String[] { FormsColumns._ID, FormsColumns.FORM_ID, FormsColumns.TABLE_ID, FormsColumns.INSTANCE_NAME }, (isNumericId ? FormsColumns._ID : FormsColumns.FORM_ID) + "=?", new String[] { formId }, null, null, null); if (c.moveToFirst()) { int idxId = c.getColumnIndex(FormsColumns._ID); int idxFormId = c.getColumnIndex(FormsColumns.FORM_ID); int idxTableId = c.getColumnIndex(FormsColumns.TABLE_ID); int idxInstanceName = c.getColumnIndex(FormsColumns.INSTANCE_NAME); return new IdInstanceNameStruct(c.getInt(idxId), ODKDatabaseUtils.get().getIndexAsString(c, idxFormId), ODKDatabaseUtils.get().getIndexAsString(c, idxTableId), ODKDatabaseUtils.get().getIndexAsString(c, idxInstanceName)); } } finally { if (c != null && !c.isClosed()) { c.close(); } } return null; }
From source file:com.idt.ontomedia.geoconsum.fragments.GeoconsumListFragment.java
@Override public void onListItemClick(ListView _listView, View _view, int _position, long _id) { super.onListItemClick(_listView, _view, _position, _id); Cursor cursor = mCursorAdapter.getCursor(); if ((cursor != null) && (!cursor.isClosed())) { cursor.moveToPosition(_position); Intent intent = new Intent(); intent.setClass(mParentActivity, mDestinationActivityClass); intent.putExtra(EXTRA_ID_KEY, cursor.getInt(cursor.getColumnIndex(DatabaseAdapter.COLUMN_ROWID))); startActivity(intent);/*w w w . j a v a 2 s .com*/ } }
From source file:li.barter.data.SQLiteLoader.java
@Override public void onCanceled(final Cursor data) { if ((data != null) && !data.isClosed()) { data.close();//from w w w. ja va2s . c o m } }
From source file:org.alfresco.mobile.android.application.providers.search.HistorySearchInlineCursorAdapter.java
@Override protected void updateTopText(TwoLinesViewHolder vh, Cursor cursor) { // ((View)vh.icon.getParent()).setTag(cursor.getLong(HistorySearchSchema.COLUMN_ID_ID)); if (cursor.isClosed()) { return;/*from www. j a va 2 s . com*/ } vh.topText.setText(cursor.getString(HistorySearchSchema.COLUMN_DESCRIPTION_ID)); HolderUtils.makeMultiLine(vh.topText, 2); }
From source file:org.kontalk.ui.adapter.ContactsListAdapter.java
@Override protected void onContentChanged() { Cursor c = getCursor(); if (c != null && !c.isClosed() && mOnContentChangedListener != null) { mOnContentChangedListener.onContentChanged(this); }//from ww w. j a va2s. c om }
From source file:fr.shywim.antoinedaniel.ui.fragment.SoundFragment.java
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { if (cursor.isClosed()) { getLoaderManager().restartLoader(mContentId, null, this); return;//from w w w . j av a 2s . c om } if (loader.getId() == MainActivity.LoaderID.SOUND_FILTER) { cursor.setNotificationUri(mContext.getContentResolver(), ProviderConstants.PLAYLIST_URI); } ((CursorRecyclerAdapter) mSoundList.getAdapter()).swapCursor(cursor); }
From source file:com.getbase.android.db.loaders.ComposedCursorLoader.java
@Override public void onCanceled(T result) { Cursor cursor = cursorsForResults.get(result); if (cursor != null && !cursor.isClosed()) { cursor.close();/*from w w w . j ava2s. c o m*/ cursorsForResults.remove(result); } }