Skip to content Skip to sidebar Skip to footer

Custom Filter Not Working In Android

I have implemented custom filter in list but not working, can some body tell me where is the problem in my code ?? this is my on create method . @Override protected void onCr

Solution 1:

Creating an Adapter to a Custom grid view or list view, both have some problems in filtering. You see that, the adapters won't filter the data in your grid or list views.

I can't paste code, but I would recommend you to take a look at implementation of ArrayAdapter.class. Make sure that ItemCategoryArrayAdapter.class has most of the methods present in ArrayAdapter.class.

Just make sure most of the methods present in ArrayAdapter.class are implemented in ItemCategoryArrayAdapter.class.

This will fix it...

Solution 2:

Change your adapter constructor as follows.

publicItemCategoryArrayAdapter(Context context, List<Item_Category> categoryList) {
     filtered = newArrayList<Item_Category>(categoryList);
    super(context, R.layout.everyday_item_category_row, R.id.itemName, filtered);
    // Cache the LayoutInflate to avoid asking for a new one each time.

You are passing the complete list ie categoryList instead of filtered List and hence it is not reflecting.

Post a Comment for "Custom Filter Not Working In Android"