Answers for "how to set text in autocompletetextview in android"

0

how to set text in autocompletetextview in android

AutoCompleteTextView autoCompleteTextView = (AutoCompleteTextView) findViewById(R.id.edt);
    String[] array = {"abc", "bcd", "cde", "def", "efg", "fgh", "PREM"};
    ArrayAdapter<String> adapter = new ArrayAdapter<String>
            (this, android.R.layout.select_dialog_item, array);

    autoCompleteTextView.setAdapter(adapter);
    autoCompleteTextView.postDelayed(new Runnable() {
        @Override
        public void run() {
            autoCompleteTextView.setText("PREM");
            autoCompleteTextView.showDropDown();

        }
    }, 10);
Posted by: Guest on February-24-2021

Code answers related to "how to set text in autocompletetextview in android"

Browse Popular Code Answers by Language