I am new to Android programming and I have a ListView when filtered always return me the first item in the list, so how do I fix this?
For instance, my list contains
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);