filtering custom adapter IndexOutOfBoundsException

前端 未结 4 1353
伪装坚强ぢ
伪装坚强ぢ 2021-01-18 00:05

I\'m novice at android.

My custom Adapter cause exception when filtering.

here is my code. private class DeptAdapter extends ArrayAdapter implements Filter

4条回答
  •  [愿得一人]
    2021-01-18 00:20

    You need to add this methods for better performance:

            @Override
            public int getCount() {
                return items.size();
            }
    
            @Override
            public Object getItem(int position) {
                return this.items.get(position);
            }
    
            @Override
            public long getItemId(int position) {
                return position;
            }
    

提交回复
热议问题