Oh, so those are your own managed cursors. FWIW, I just tried this in my autocomplete view class:
@Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); CursorAdapter adapter = (CursorAdapter) getAdapter(); adapter.changeCursor(null); } Works just as well, strict mode doesn't get tripped up, but keeps everything self-contained. Thanks for a great discussion. -- Kostya 14 января 2012 г. 1:54 пользователь swebb99 <sweb...@gmail.com> написал: > Nice :) > > I did it slightly differently. I already had a standard top level > Activity all my Activities inherit from so in there i defined: > > List<CursorAdapter> managedCursorAdaptors = new > ArrayList<CursorAdapter>(); > > and added the following methods: > > protected void addManagedCursorAdapter(CursorAdapter adapter) { > managedCursorAdaptors.add(adapter); > } > > protected void removeManagedCursorAdapter(CursorAdapter adapter) { > managedCursorAdaptors.remove(adapter); > } > > protected void closeAllManagedCursorAdapters() { > Cursor cursor = null; > for(CursorAdapter adapter : managedCursorAdaptors) { > cursor = adapter.getCursor(); > if(cursor != null) { > cursor.close(); > } > } > } > > I then in the onDestroy() called the closeAllManagedCursorAdapters. > > Within my Activities whenever I created a CursorAdapter I don't keep a > reference to it as such I just call addManagedCursorAdapter(adapter) > and forget about it. > > Seems to be working well enough and it's just set and forget. > > Steve > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en