I have a DialogFragment
and in it\'s layout I have a EditText
and a ListView
. The Listview basically shows the list of contacts (Initially
You are trying to change visible list with changing emailContacts
, but adapter still contains old list data.
Solution: after each new text in EditText
create new adapter (is a VERY bad way), or create method in EmailContactAdapter
to replace items - in your case contacts
field.
Try delete all emailContacts.clear();. Then add emailContacts.clear(); just before emailContacts.addAll(commonMethods.getEmailContacts(appContext, textValue));. You are appending your list for every letter your typed.
In the below code, you are populating the list with the result of commonMethods.getEmailContacts
// Get the email contacts list based on the user query
emailContacts.addAll(commonMethods.getEmailContacts(appContext, textValue));
Surely you first need to do emailContacts.Clear()
otherwise the list is not going to change?