Q:

Filter ListView when tab changed

I need to filter a ListView in one activity with three tabs.  For instance, I have one tab where are displayed info about all the devices (custom object), but when I change to other tab, it should display the devices of "type1" and when I change to the last tab it displays the devices of "type2". 
I already have a custom adapter, and I want to know if I can use the Filterable interface (... implements Filterable ...) and override the getFilter() method (like filtering based on editText) or I should use another approach? 
Grateful for any kind of help. 

A:

I solve this using the onTabChanged() method, like this (in the onCreate()):
mTabHost.setOnTabChangedListener(new OnTabChangeListener() {

        public void onTabChanged(String tabId) {
            Log.d(debugTag, "onTabChanged: tab number=" + mTabHost.getCurrentTab());

            switch (mTabHost.getCurrentTab()) {
            case 0:
                myDevAdapter.getFilter().filter("all");
                break;
            case 1:
                myDevAdapter.getFilter().filter("type1");
                break;
            case 2:
                myDevAdapter.getFilter().filter("type2");
                break;

            default:
                Log.d(debugTag,"error in onTabChanged");
                break;
            }
        }
    });

