ListView custom filter gives wrong item selected when filtered [Android]

做~自己de王妃 提交于 2019-11-28 13:34:14

Because you filter your adapter to have B.C in position 0 and B.D in position 1. But in your implementation of your onClickListener, you use the listview's position to get directly from the source ArrayList.

String a = patientArrayList.get(position);

Instead to get it from the filtered adapter:

String a = parent.getAdapter().getItem(position);

or

String a = parent.getItemAtPosition(position);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!