Skip to content Skip to sidebar Skip to footer

Filtering Simplecursoradapter

This code is working properly by showing all the data in database but i have a problem in filtering. I try many code but nothing works , can someone help me out ? thanks pac

Solution 1:

it is not working because adapter.getfilter().filter(cs); does not work directly for SimpleCursorAdapter. you have to use adapter.setFilterQueryProvider first for SimpleCursorAdapter.

here is the complete description: ListView, SimpleCursorAdapter, an an EditText filter -- why won't it do anything?

and this: Using an EditText to filter a SimpleCursorAdapter-backed ListView

Solution 2:

Try this....

@OverridepublicvoidonTextChanged(CharSequence cs, int arg1, int arg2, int arg3) {
// When user changed the Text
((SimpleAdapter) YourActivity.this.adapter).getFilter().filter(cs);  
}

Post a Comment for "Filtering Simplecursoradapter"