How to search within ListView with custom adapter

后端 未结 1 1005
野性不改
野性不改 2021-01-24 18:04

I looked at the following site: ListView Example

Which describes how to implement a search function in a listview which uses the default adapter and it works fine.

相关标签:
1条回答
  • 2021-01-24 18:33

    You need to override getFilter inside of your adapter and return a new customFilter object that you create. See this answer: No results with custom ArrayAdapter Filter

    Edit:

    @Override
        public Filter getFilter() {
            if(customFilter == null){
                customFilter = new CustomFilter();
            }
            return customFilter;
        }
    
    0 讨论(0)
提交回复
热议问题