List of usage examples for android.content EntityIterator close
public void close();
From source file:edu.cens.loci.ui.PlaceViewActivity.java
public void onQueryComplete(int token, Object cookie, final Cursor cursor) { final ArrayList<Entity> oldEntities = mEntities; (new AsyncTask<Void, Void, ArrayList<Entity>>() { @Override/* ww w. j ava 2s. c o m*/ protected ArrayList<Entity> doInBackground(Void... params) { ArrayList<Entity> newEntities = new ArrayList<Entity>(cursor.getCount()); EntityIterator iterator = Places.newEntityIterator(cursor); try { while (iterator.hasNext()) { Entity entity = iterator.next(); newEntities.add(entity); } } finally { iterator.close(); } return newEntities; } @Override protected void onPostExecute(ArrayList<Entity> newEntities) { if (newEntities == null) { // There was an error loading. return; } synchronized (PlaceViewActivity.this) { if (mEntities != oldEntities) { // Multiple async tasks were in flight and we // lost the race. return; } mEntities = newEntities; mHasEntities = true; } considerBindData(); } }).execute(); }