I have extended an SimpleCursorAdapter and define a
FilterQueryProvider like so:

setFilterQueryProvider(new FilterQueryProvider() {
    public Cursor runQuery(CharSequence constraint) {
        return getMatching(constraint);
    }
});

I can't see how the Cursor can be managed because this class is called
from the a background thread via the CursorAdaptor class:

public Cursor runQueryOnBackgroundThread(CharSequence constraint) {
    if (mFilterQueryProvider != null) {
        return mFilterQueryProvider.runQuery(constraint);
    }
    return mCursor;
}

Now the documentation for this method states that:

After this method returns the resulting cursor is passed to {@link
#changeCursor(Cursor)} and the previous cursor is closed.

As can be seen from the code that does not seem to be the case, infact
nothing is done with the cursor and so it is left dangling and not
closed.

I tried to override the runQueryOnBackgrounfThread on my own extended
Adapter and call changeCursor(c) in it however that results in an
exception because this triggers off a chain of events which attempt to
modify the associated adapters view not from the UI thread.

So any idea's how I manage (close) the cursor returned from my filter?

Thanks

-- 
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

Reply via email to