Code example for Filter

Methods: filter

0
        searchViewStrategy = (Build.VERSION.SDK_INT >= HONEYCOMB) ? new HoneycombStrategy() : new LegacyStrategy();
        searchViewStrategy.setup(searchMenuItem, new SearchViewStrategy.OnFilterTextListener() {
            public void onFilterTextChange(String newText) {
                Filter filter = filterable.getFilter();
                if (filter != null)
                    filter.filter(newText);
            } 
 
            public void onFilterTextSubmit(String query) {
                Log.d(TAG, "onFilterTextSubmit : '"+query+"'");
                clearSearchViewOnSubmit(); 
            } 
        }); 
    } 
 
    public void onSearchRequested() { 
        searchMenuItem.expandActionView();
    } 
 
    /** 
     * When the search is "committed" by the user, then hide the keyboard so the user can more easily browse the list