how to populate autocompletetextview with string array created in a class

android, autocompletetextview

Solution

Try this...

autocompletetextAdapter = new ArrayAdapter<String>(
                        this,
                        android.R.layout.simple_dropdown_item_1line, stringArray);

myAutocompleteTextView.setAdapter(autocompletetextAdapter);

Problem

Generally `AutoCompleteTextView` is populated with `strings.xml` file in `res/values` folder. Can anyone tell me how to use a string array created in the class to populate `AutoCompleteTextView`?

Original source