ListView does not update until keyboard is hidden

后端 未结 3 1029
名媛妹妹
名媛妹妹 2021-02-20 10:09

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

相关标签:
3条回答
  • 2021-02-20 10:16

    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.

    0 讨论(0)
  • 2021-02-20 10:20

    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.

    0 讨论(0)
  • 2021-02-20 10:39

    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?

    0 讨论(0)
提交回复
热议问题