Issue
So I have this AutoCompleteTextView
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox.ExposedDropdownMenu">
<AutoCompleteTextView
android:id="@+id/actv_choices"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="Choose"
android:inputType="none"
android:text="Handicapped "/>
</com.google.android.material.textfield.TextInputLayout>
This is how it looks visualy
I want to achieve that when the client starts the activity it will initialize the value of the AutoCompleteTextView to be one of the values of my list values that I set in the adapter for example, I got these values
And I want that when the client opens the app it will set the value to be for example the second value like that by default
How can I achieve this?
Solution
After setting the adapter for your autoComplete textView you can do this:
Your custom data list ex. List<YourCustomModel> data
actvChoices.setText(data.get(index));
Answered By - Saif
Answer Checked By - Marie Seifert (JavaFixing Admin)