0

How are start, before, and count values called when we choose a prediction, for ex Do->Doc->Document. It sometimes deletes the word and inserts again with 2 calls, sometimes in the same call.

Please advice.

  • If you're trying to implement a TextView with autocomplete suggestions, use the AutocompleteTextView. More information can be found here: http://developer.android.com/reference/android/widget/AutoCompleteTextView.html – Saket Feb 18 '14 at 13:22

1 Answers1

1

Check this link & take reference. of below code.

 et1.addTextChangedListener(new TextWatcher() {
        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {

          /*Whenever You will Enter Any Word, Here You will Predict that Which Character       is inserted.*/
        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            // TODO Auto-generated method stub
        }

        @Override
        public void afterTextChanged(Editable s) {

            // TODO Auto-generated method stub
        }
    });

OR As @Saket Suggested. if you are using TextView for Text watching then use AutoCompleteTextView with below code.

ArrayAdapter<String> aCustListAdapterNo = new ArrayAdapter<String>(
            mContext, android.R.layout.select_dialog_item,
            fillAutoCompleteCustomerListNo);
    **autoCompletetxtViewCUSListNo.setThreshold(1);**
    autoCompletetxtViewCUSListNo.setAdapter(aCustListAdapterNo);

Hope this helps you.

Community
  • 1
  • 1
i.n.e.f
  • 1,773
  • 13
  • 22