views:

311

answers:

0

Hi List!

I have a ListView which is connected to a ArrayAdapter where Artist is a simple class of mine, that has only an id and a name.

Now i want to filter the ListView so i call:

artistAdapter.getFilter().filter("bla", new Filter.FilterListener() {
    public void onFilterComplete(int count) {
        Log.d(Config.LOG_TAG, "filter complete! count: " + count); // returns 8
        Log.d(Config.LOG_TAG, "adapter count: " + artistAdapter.getCount()); // return 1150
    }
});

The first debug statement prints a count of 8. That's the corrent count for listitems that start with "bla" but the adapter does not get it. the second debug statement prints a count 1150 items. that's the complete number of items in the list.

so somehow the filter does not tell the adapter that it has filtered the underlying data.

i want to know now: do i have do code something in my adapter so it gets the updates from the filter? do i have to write a custom filter? what do i have to do?

Thanks, Anton