开发者

FilterQueryProvider not updating ListView

Trying to use the FilterQueryProvider function to update the contents of a ListView, as characters are entered into the filter, my runQuery function does get called, and a new cursor with filtered content is returned, but the ListView does not update to show the new contents. The docs state that after runQuery returns, changeCursor is called. Isn't this enough to update the ListView display? My code to set up the filter is:

    mAdapter = new ItemAdapter(curs);
    mAdapter.setFilterQueryProvider(new ItemFilter());
    setListAdapter(mAdapter);

And my filter class is simply:

class ItemFilter implements FilterQueryProvider {
    public Cursor runQuery(CharSequence filter) {
        return getNewCursor(filter);
    }
}

The cursor from getNewCursor does correctly fetch a subset of the rows. Have I missed something in ge开发者_运维技巧tting the ListView to update?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜