使用TextWatcher过滤ListView会获得IndexOutOfBoundsException

时间:2016-01-25 10:32:41

标签: java android listview textwatcher

我已尝试过此Filter ListView with arrayadapter和此Filter List链接,以获得可过滤的列表,但我一直收到此错误:

  

流程:br.com.soutsapp.user.souts,PID:315                                                                           java.lang.IndexOutOfBoundsException:索引0无效,大小为0                                                                               at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)                                                                               at java.util.ArrayList.get(ArrayList.java:308)                                                                               at br.com.soutsapp.user.souts.userInterface.adapter.EstablishmentAdapter.getView(EstablishmentAdapter.java:54)

此错误发生在我的ViewController

getView

我无法弄清楚如何解决这个问题,你能给我指路吗?谢谢!

2 个答案:

答案 0 :(得分:0)

您在哪里填充数据?我的意思是你在哪里设置for循环来添加数据?

答案 1 :(得分:0)

覆盖getCount方法并返回列表大小。在适配器类中。