App/src/main/res/layout/activity_main.xml
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" tools:context=".MainActivity"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Android Java MultiAutoCompleteTextView" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <MultiAutoCompleteTextView android:id="@+id/multiautocompletetextview" android:layout_width="fill_parent" android:layout_height="wrap_content" android:completionThreshold="1" /> </LinearLayout>app/src/main/java/com/myappdev/MainActivity.Java
package com.myappdev; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.widget.ArrayAdapter; import android.widget.MultiAutoCompleteTextView; public class MainActivity extends AppCompatActivity { MultiAutoCompleteTextView myMultiAutoCompleteTextView; String item[]={ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); MultiAutoCompleteTextView myMultiAutoCompleteTextView = (MultiAutoCompleteTextView)findViewById( R.id.multiautocompletetextview); myMultiAutoCompleteTextView.setAdapter( new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, item)); myMultiAutoCompleteTextView.setTokenizer( new MultiAutoCompleteTextView.CommaTokenizer()); } }