1

I have an AutoCompleteTextView in my layout and I want to do an API call which takes the first character entered as a parameter. I do this API call in an AsyncTask to which I pass the first character as a parameter.

What listener should I use on AutoCompleteTextView so that AsyncTask call happens right after the first character is inputted ?

rsd_unleashed
  • 151
  • 2
  • 12

2 Answers2

0

Try this link http://makovkastar.github.io/blog/2014/04/12/android-autocompletetextview-with-suggestions-from-a-web-service/

I achieved the above functionality using shared article.

Attiq ur Rehman
  • 475
  • 1
  • 6
  • 21
0

Fixed this issue using addTextChangedListener.

@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
            if (s.toString().trim().length() == 1) {
                isFileReceived = false;
                mAirport = new AsyncTaskAirport(s.toString());
                mAirport.execute((Void) null);
            }
rsd_unleashed
  • 151
  • 2
  • 12