Domanda

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.

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top