westmeadboy wrote:
> Caching search results. The searches happen as the user types so when
> a user hits backspace its nice if the results are shown instantly
> rather than requerying.

Bear in mind that Cursors hold a copy of the query result set. The more
Cursors you hold onto, the more memory you consume.

Going back to your original problem, I don't see how you're getting into
trouble. You have N Cursors. One of these Cursors is in a ListView. You
know which one of these Cursors is in a ListView (your statement "so do
not know how a given cursor is being used" is false). The other Cursors
are, hopefully, not in a ListView. So you have:

-- 1 ListView
-- 1 CursorAdapter
-- N Cursors

I assume you are not calling close() on the Cursor that is in the
CursorAdapter, as the user is kinda looking at it. None of the other
Cursors should be connected to the UI, and so you should not get that
exception.

If you are getting the exception on a Cursor that is not held by any
CursorAdapter/ListView, that might be a bug in Android, or perhaps some
other step you need to do to completely detach the Cursor from the
CursorAdapter when you swap in another Cursor.

If you actually have N ListViews and N CursorAdapters, please
reconsider. That's gobs more memory you're taking up and, among other
things, leaves you open for this error.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

_Android Programming Tutorials_ Version 2.0 Available!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe, reply using "remove me" as the subject.

Reply via email to