How do i show suggessions in AutoCompleteTextView Android?

32 views Asked by At

there

I have an problem like suggestions not showing automatically in AutoCompleteTextView,

So what is my flow?

  1. I added an com.google.android.material.textfield.MaterialAutoCompleteTextView
  2. initialize the variable in Kotlin using binding.
  3. Set empty Adapter to MaterialAutoCompleteTextView
  4. now i implement an logic in MaterialAutoCompleteTextView
    • If user input an word, after 1 second i hit an api for suggestions
    • i got success in fetching suggestions in API
    • where i got suggestions, there i notify MaterialAutoCompleteTextView adapter

Problem

- I did not show any suggestions in `MaterialAutoCompleteTextView`
- but i fetch suggestions successfully

If i remove one character or type one character then it show APIs suggestions properly

What is my requirement

  • i need to show suggestions automatically when API fetch suggestions successfully
  • do not wanna using
autoCompletetextView.text = autoCompletetextView.text.toString()

What i tried

  • showDropDown()
  • performCompletion()
  • adapter.notifyDataSetChange()
0

There are 0 answers