I have seen the filter method documentation which shows that calling the filter cancels all previous non-executed filtering requests and posts a new filtering request that will be executed later.
But the actual callback which i received is some how different.In my implementation it is not cancelling the previous filter request and calls the publishResults()
method for the previous search criteria after the recent search criteria .The logs are as follows:
10-03 17:49:41.781: E/TAG(2150): onTextChanged first Criteria
10-03 17:49:41.781: E/TAG(2150): performFiltering first Criteria
10-03 17:49:41.961: E/TAG(2150): onTextChanged second Criteria
10-03 17:49:41.961: E/TAG(2150): performFiltering second Criteria
10-03 17:49:42.195: E/TAG(2150): publishResults second Criteria
10-03 17:49:42.219: E/TAG(2150): publishResults first Criteria
You have to use only one single instance of Filter
in your adapter to be able to cancel any previous non-executed filtering request. Don't create a new instance of Filter
every time getFilter
is called.
For example, initialize it on adapter initialization, and just return it from getFilter
method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With