Custom Listview Adapter with filter Android

后端 未结 10 690
北荒
北荒 2020-11-22 06:07

Please am trying to implement a filter on my listview. But whenever the text change, the list disappears.Please Help Here are my codes. The adapter class.

p         


        
10条回答
  •  清酒与你
    2020-11-22 07:05

    One thing I've noticed is that whenever you are editing the list (adding items for example) as well as filtering for it, then inside the @Override getView method, you shouldn't use filteredData.get(position), as it throws an IndexOutOfBounds exception.

    Instead, what worked for me, was using the getItem(position) method, which belongs to the ArrayAdapter class.

提交回复
热议问题